开发者

How Do I code this in python with simplejson

开发者 https://www.devze.com 2022-12-25 01:18 出处:网络
how do i code a python program that return ajson element that look like this {1:{\'name\':foo,\'age\':xl}

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

精彩评论

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