python json

json.dump

write to io

io = StringIO()
json.dump(['streaming API'], io)

json.dumps

get JSON String

json_str = json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}])

json.load

read from io

io = StringIO('["streaming API"]')
json.load(io)

json.loads

parse JSON String

json_obj = json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]')

json – JSON encoder and decoder – Python 3.9.5 documentation

Source code: Lib/json/__init__.py Compact encoding: Pretty printing: Decoding JSON: Specializing JSON object decoding: Note JSON is a subset of YAML 1.2. The JSON produced by this module’s default settings (in particular, the default separators value) is also a subset of YAML 1.0 and 1.1. This module can thus also be used as a YAML serializer.