Python 解析json

import json

stringOfJsonData = '{"name":"test","listData":[{"name":"test1"},{"name":"test2"}]}'

jsonDataAsPythonValue = json.loads(stringOfJsonData)
print(jsonDataAsPythonValue['name'])
print(jsonDataAsPythonValue['listData'][0]["name"])

 

输出:

test

test1

1836

Leave a Reply

Name and Email Address are required fields.
Your email will not be published or shared with third parties.