Question : Ajax/Json decode for multi-dimension arrays using JQuery/JS

I am trying to get my head around multi-dimension arrays in JQuery/JS.
From the returned JSON string (below) returned from an Ajax from JS, I need to be able to:

1. Store the top level value (e.g. 12345)
2. Then iterate through the remaining key/value pairs

So, if a simple output was required, I need:
12345
name1:value1
name2:value2
name3:value3

98765
name1:value1a
name2:value2a
name3:value3a

I have tried using the JSON.parse function but to no avail.
Could someone show me a worked example utilising JQuery/JS from the description above?

Many thanks
BT


1:
2:
3:
4:
5:
6:
The following array when encoded into JSON :
$arr['12345'] = array('name1' => 'value1', 'name2' => 'value2', 'name3' => 'value3');
$arr['98765'] = array('name1' => 'value1a', 'name2' => 'value2a', 'name3' => 'value3a');

gives output of
{"12345":{"name1":"value1","name2":"value2","name3":"value3"},"98765":{"name1":"value1a","name2":"value2a","name3":"value3a"}}

Answer : Ajax/Json decode for multi-dimension arrays using JQuery/JS

You can download the RSAT tool that will enable you to see the Windows 7 policies for your 2003 domain here: http://go.microsoft.com/fwlink/?LinkId=130862
Random Solutions  
 
programming4us programming4us