jsonyx.allow.NON_STR_KEYS

jsonyx.allow.NON_STR_KEYS = frozenset({'non_str_keys'})

Allow non-string keys in "object" types.

Added in version 2.0.

>>> import jsonyx as json
>>> jsonyx.allow
>>> json.dump({1: 0}, allow=jsonyx.allow.NON_STR_KEYS)
{"1": 0}

Warning

This can result in duplicate keys if a non-string key is serialised to the same string as an existing key.