Classes | |
| class | ExtendedJSONEncoder |
| class | JSONEncoder |
Functions | |
| bytes | _orjson_bytes_default_encoder (Any data) |
| str | _orjson_default_encoder (Any data) |
| Any | _strip_null (Any obj) |
| dict[str, Any] | find_paths_unserializable_data (Any bad_data, *Callable[[Any], str] dump=json.dumps) |
| bytes | json_bytes (Any obj) |
| bytes | json_bytes_strip_null (Any data) |
| str | json_dumps (Any data) |
| str | json_dumps_sorted (Any data) |
| Any | json_encoder_default (Any obj) |
| None | save_json (str filename, list|dict data, bool private=False, *type[json.JSONEncoder]|None encoder=None, bool atomic_writes=False) |
Variables | |
| __all__ | |
| __dir__ | |
| __getattr__ | |
| _DEPRECATED_JSON_DECODE_EXCEPTIONS | |
| _DEPRECATED_JSON_ENCODE_EXCEPTIONS | |
| _LOGGER | |
| breaks_in_ha_version | |
| check_if_deprecated_constant | |
| default = json_encoder_default, | |
| dir_with_deprecated_constants | |
| dumps | |
| json_bytes | |
| json_bytes_sorted | |
| json_fragment | |
| json_loads | |
| module_globals | |
| module_globals_keys | |
| OPT_NON_STR_KEYS | |
| option = orjson.OPT_NON_STR_KEYS | orjson.OPT_SORT_KEYS, | |
Helpers to help with encoding Home Assistant objects in JSON.
|
private |
|
private |
|
private |
| dict[str, Any] homeassistant.helpers.json.find_paths_unserializable_data | ( | Any | bad_data, |
| *Callable[[Any], str] | dump = json.dumps |
||
| ) |
| bytes homeassistant.helpers.json.json_bytes | ( | Any | obj | ) |
| bytes homeassistant.helpers.json.json_bytes_strip_null | ( | Any | data | ) |
| str homeassistant.helpers.json.json_dumps | ( | Any | data | ) |
Dump json string. orjson supports serializing dataclasses natively which eliminates the need to implement as_dict in many places when the data is already in a dataclass. This works well as long as all the data in the dataclass can also be serialized. If it turns out to be a problem we can disable this with option \|= orjson.OPT_PASSTHROUGH_DATACLASS and it will fallback to as_dict
| str homeassistant.helpers.json.json_dumps_sorted | ( | Any | data | ) |
| Any homeassistant.helpers.json.json_encoder_default | ( | Any | obj | ) |
| None homeassistant.helpers.json.save_json | ( | str | filename, |
| list | dict | data, | ||
| bool | private = False, |
||
| *type[json.JSONEncoder] | None | encoder = None, |
||
| bool | atomic_writes = False |
||
| ) |
|
private |
|
private |
| Any homeassistant.helpers.json.default = json_encoder_default, |