Workaround to_json
template filter in parsing dict key (#105327)
* Work-a-round orjson for `to_json` fiter in case dict key is str subclass * Add option instead * Remove json.dumps work-a-round * Update homeassistant/helpers/template.py * Fix test --------- Co-authored-by: Erik Montnemery <erik@montnemery.com>
This commit is contained in:
parent
af715a4b9a
commit
4bb0e13cda
2 changed files with 20 additions and 0 deletions
|
@ -2125,6 +2125,10 @@ def to_json(
|
|||
|
||||
option = (
|
||||
ORJSON_PASSTHROUGH_OPTIONS
|
||||
# OPT_NON_STR_KEYS is added as a workaround to
|
||||
# ensure subclasses of str are allowed as dict keys
|
||||
# See: https://github.com/ijl/orjson/issues/445
|
||||
| orjson.OPT_NON_STR_KEYS
|
||||
| (orjson.OPT_INDENT_2 if pretty_print else 0)
|
||||
| (orjson.OPT_SORT_KEYS if sort_keys else 0)
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue