Creating Python dict from JSON

Download python eBook

Example

import json
s = '{"wonderland": [1, 2, 3], "foo": "bar", "alice": 1}'
json.loads(s)

The above snippet will return the following:

{u'alice': 1, u'foo': u'bar', u'wonderland': [1, 2, 3]}

Stats

Contributors: 2
2016-03-27
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook