The zaqar.transport.utils
module¶
-
exception
MalformedJSON
¶ Bases:
exceptions.ValueError
JSON string is not valid.
-
exception
OverflowedJSONInteger
¶ Bases:
exceptions.OverflowError
JSON integer is too large.
-
read_json
(stream, len)¶ Like json.load, but converts ValueError to MalformedJSON upon failure.
Parameters: - stream – a file-like object
- len – the number of bytes to read from stream
-
to_json
(obj)¶ Like json.dumps, but outputs a UTF-8 encoded string.
Parameters: obj – a JSON-serializable object