dumps

dumps(value: Any)

The canonical text of a JSON value (dicts with string keys, lists, strings, ints, finite floats, booleans and None), ending in a newline.

>>> dumps([])
'[]\n'

Raises

Name Type Description
TypeError for a value of any other type (a tuple, a Fraction, a non-string key).
ValueError for a float that is not finite, or a string holding a lone surrogate.