开发者

How Do I code this in python with simplejson

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 开发者_C百科 # to the the value of name in the clientside

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

thanks in advance


>>> 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}]}'
>>> 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜