Crate destream_json

source ·
Expand description

Library for decoding and encoding JSON streams.

Example:

let expected = ("one".to_string(), 2.0, vec![3, 4]);
let stream = destream_json::encode(&expected).unwrap();
let actual = block_on(destream_json::try_decode((), stream)).unwrap();
assert_eq!(expected, actual);

Deviations from the JSON spec:

  • destream_json will not error out if asked to decode or encode a non-string key in a JSON object (i.e., it supports a superset of the official JSON spec). This may cause issues when using another JSON library to decode a stream encoded by destream_json. This behavior can be altered by using only strings as keys, or adding an explicit check at encoding time.

Re-exports

Modules

  • Decode a JSON stream to a Rust data structure.
  • Encode a Rust data structure into JSON data.