Skip to main content
Version: Next

json

encode

encode(
data: any,
sort_keys: bool = False,
indent: int = None,
ignore_private: bool = False,
ignore_none: bool = False
) -> str

Serialize a KCL object data to a JSON formatted str.

decode

decode(value: str) -> any

Deserialize value (a string instance containing a JSON document) to a KCL object.

dump_to_file

dump_to_file(
data: any,
filename: str,
sort_keys: bool = False,
indent: int = None,
ignore_private: bool = False,
ignore_none: bool = False
) -> None

Serialize a KCL object data to a JSON formatted str and write it into the file filename.

validate

validate(value: str) -> bool

Validate whether the given string is a valid JSON.