Skip to main content

json

No overview available.

def json(
data: Any,
indent: int = 4
) - > string

Serializes a Python object into a JSON-formatted string with standardized indentation and sorted keys. Use this to ensure consistent formatting for configuration files or API responses.

Parameters

NameTypeDescription
dataAnyThe Python dictionary, list, or scalar value to be serialized into JSON format.
indentint = 4The number of spaces used for indentation in the output string to ensure human readability.

Returns

TypeDescription
stringA UTF-8 encoded string containing the JSON representation of the input data.