refer: http://www.json.org/
JSON | Python |
---|---|
object | dict |
array | list |
string | unicode |
number (int) | int, long |
number (real) | float |
true | True |
false | False |
null | None |
import json json_string = '{"first_name": "Guido", "last_name":"Rossum"}' parsed_json = json.loads(json_string) print parsed_json
output:return python object
{u'first_name': u'Guido', u'last_name': u'Rossum'}
And we can access the property first_name with command:
print parsed_json['first_name']
Python | JSON |
---|---|
dict | object |
list, tuple | array |
str, unicode | string |
int, long, float | number |
True | true |
False | false |
None | null |