tags:

views:

98

answers:

1

how do i code a python program that return a json element that look like this

{1:{'name':foo,'age':xl}
  2:{'name':vee,'age':xx}
  ....
}

What i meant is that i want return nested dictionaries

What i hoped to accomplish is something like this

var foo = 1.name  # to the the value of name in the clientside

I hope all this made sense .English is my second language

thanks in advance

+3  A: 
>>> import simplejson as json 
    # "simplejson" works exactly the same as with "json"
>>> json.dumps({})
'{}'
>>> json.dumps({'asdf':1,'poi':[2,3,4,{'qwer':5}]})
'{"asdf": 1, "poi": [2, 3, 4, {"qwer": 5}]}'
>>> 
voyager
voyager thanks you have to break down your answer for me please. i want asdf for example to be increase down the line.You know 1,2,3 ....
Spikie