# String to object

**URL:** https://forum.kirupa.com/t/string-to-object/295138
**Category:** Uncategorized
**Created:** [August 25, 2009, 8:30pm UTC](https://forum.kirupa.com/t/string-to-object/295138 "2009-08-25T20:30:46Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![rondog](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rondog/32/2478_2.png) [@rondog](https://forum.kirupa.com/u/rondog)
#### Post date: [August 25, 2009, 8:30pm UTC](https://forum.kirupa.com/t/string-to-object/295138/1 "2009-08-25T20:30:46Z")

</div>

I have an object called clientData.

ex:

```auto

clientID : 2
email : ronnieswietek[at]gmail[dot]com
organization : digital OutPost Client
username : rondogs12
userLevel : 1
phone : 7608555555
password : 1234
clientName : Ronnie Swietek Client

```

Say I need to update the ‘username’ part of the object.

I would go:

```auto
clientData.username = value;

```

The problem is I need to update with ‘username’ coming in as a string.

This is my function to update the object:

```auto

public function setClientData(field:String,value:String):void
{
	clientData.field = value;
	for (var value:String in clientData)
	{
		trace(value + " : " + clientData[value]);
	}

}

```

if I do that, it just adds a new item in the object called field. I need field to be username. Any ideas???
