Python json
From wikinotes
Documentation
official docs https://docs.python.org/3/library/json.html?highlight=json#module-json
datatypes
JSON natively supports 6x datatypes:
// simple datatypes { "string" = "my string", "number" = 9999, "boolean" = true, "null" = null } // compound datatypes { "object" = { "a":1, "b":1 }, // a dictionary "array" = [ "a","b","c" ] }
write
with open(filepath, 'w') as fd: fd.write(json.dumps({'a': 1}, indent=4))
read
with open(filepath, 'r') as fd: my_dict = json.load(fd)