Convert Strings to Objects with DoConvert

Hi,

Easily convert Strings to Objects (or Arrays) with DoConvert.

The Library allows you to parse any String formatted in the short Array or Object syntax.

Any given datatype within the String will be converted to its logical ActionScript 3 pendant (i.e. {a:true, b:50}, the value a will be typed Boolen. The value b, uint).

example:

import de.davidochmann.utilities.doconvert.DoConvert;
 
var st1:String = "['a', 1, 1.5, -5, {a:true, b:false}]";
var arr:Array  = DoConvert .toArray(st1);        
trace(arr[0], arr[2], arr[4].a); // returns: a 1.5 true

var st2:String = "{a:'\"foo\"', b:{a:['bar', 2, 3], b:2}}";
var obj:Object = DoConvert.toObject(st2);
trace(obj.a, obj.b.a[0]); //"foo" bar

hf,
David