ID EN
JSON

encode

Python 3.11

Return a JSON string representation of a Python data structure, o. For example:

Syntax

PYTHON
encode(o)

Examples

Example 1
PYTHON
>>> json.JSONEncoder().encode({"foo": ["bar", "baz"]})
'{"foo": ["bar", "baz"]}'