dump



examples/json/dump.py
import json

data = {
    "fname" : 'Foo',
    "lname" : 'Bar',
    "email" : None,
    "children" : [
        "Moo",
        "Koo",
        "Roo",
    ],
}

print(data)

with open('data.json', 'w') as fh:
    json.dump(data, fh)

As a special case dump will save the string in a file or in other stream.