Creating JSON from Python dict
suggest changeimport json
d = {
'foo': 'bar',
'alice': 1,
'wonderland': [1, 2, 3]
}
json.dumps(d)
The above snippet will return the following:
'{"wonderland": [1, 2, 3], "foo": "bar", "alice": 1}'
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents