# Fieldnames, dynamic arrays, oh my!

**URL:** <https://forum.kirupa.com/t/fieldnames-dynamic-arrays-oh-my/126718>\
**Category:** Uncategorized\
**Created:** [October 26, 2004, 6:43pm UTC](https://forum.kirupa.com/t/fieldnames-dynamic-arrays-oh-my/126718 "2004-10-26T18:43:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![newhopekenny](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/newhopekenny/32/317_2.png) [@newhopekenny](https://forum.kirupa.com/u/newhopekenny)\
**Post date:** [October 26, 2004, 6:43pm UTC](https://forum.kirupa.com/t/fieldnames-dynamic-arrays-oh-my/126718/1 "2004-10-26T18:43:42Z")

</div>

All right.

I’ve got data coming from a FlashCom server, coming in as a hash array.

I’m breaking the data like so:

```auto
myResult.onResult = function(data) {
	dataArray = new Array();
	for (var key in data) {
		for (var key1 in data[key]) {
			var keyVar = data[key][key1];
			var monthVar = key1;
			dataArray.push([key, monthVar, keyVar]);
		}
	}
};

```

I’d like to amend that second for statement to have fieldnames like so:

```auto
myResult.onResult = function(data) {
	dataArray = new Array();
	for (var key in data) {
		for (var key1 in data[key]) {
			var keyVar = data[key][key1];
			var monthVar = key1;
			dataArray.push({engine:key, date:monthVar, value:keyVar});
		}
	}
};

```

Of course it doesn’t work. But how could I get it so that it does? I can do something like this:

```auto
var my_array:Array = new Array();
my_array.push({password: "Bob", age:29});
my_array.push({password: "abcd", age:3});
my_array.push({password: "barb", age:35});
my_array.push({password: "catchy", age:4});

```

I just need to know how to do this dynamically. Any help would be more than wonderful. (Two for two IPaq…;)?)
