# Convert Strings to Objects with DoConvert

**URL:** https://forum.kirupa.com/t/convert-strings-to-objects-with-doconvert/303512
**Category:** open source
**Created:** [January 21, 2010, 1:47pm UTC](https://forum.kirupa.com/t/convert-strings-to-objects-with-doconvert/303512 "2010-01-21T13:47:58Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![MRWUT4](https://avatars.discourse-cdn.com/v4/letter/m/ba9def/32.png) [@MRWUT4](https://forum.kirupa.com/u/MRWUT4)
#### Post date: [January 21, 2010, 1:47pm UTC](https://forum.kirupa.com/t/convert-strings-to-objects-with-doconvert/303512/1 "2010-01-21T13:47:58Z")

</div>

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:

```auto
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
