json

json_serialize(item: Any) str

Serializes an item into a json.

>>> json_serialize({'one': 1, 'two': 2, 'three': 3})
'{"one":1,"two":2,"three":3}'
Parameters:

item (Any) – The item that will be serialized

Returns:

The serialized item

Return type:

str

Raises:

Exception – raised if the item is an integer value out of the Neo’s accepted range, is a dictionary with a bytearray key, or isn’t serializable.

json_deserialize(json: str) Any

Deserializes a json into some valid type.

>>> json_deserialize('{"one":1,"two":2,"three":3}')
{'one': 1, 'three': 3, 'two': 2}
Parameters:

json (str) – A json that will be deserialized

Returns:

The deserialized json

Return type:

Any

Raises:

Exception – raised if jsons deserialization is not valid.