#json #stream #serialize #deserialize

destream_json

Library for decoding & encoding a JSON stream

20 releases

0.10.1 Jan 24, 2023
0.9.0 Apr 25, 2022
0.8.5 Nov 16, 2021
0.8.1 Jul 14, 2021
0.5.2 Mar 23, 2021

#736 in Encoding

Download history 9/week @ 2022-10-10 4/week @ 2022-10-17 8/week @ 2022-10-24 34/week @ 2022-10-31 14/week @ 2022-11-07 17/week @ 2022-11-14 6/week @ 2022-11-21 4/week @ 2022-11-28 10/week @ 2022-12-05 11/week @ 2022-12-12 14/week @ 2022-12-19 59/week @ 2022-12-26 15/week @ 2023-01-02 24/week @ 2023-01-09 30/week @ 2023-01-16 37/week @ 2023-01-23

106 downloads per month
Used in tinychain

Apache-2.0

74KB
2K SLoC

destream_json

Rust library for encoding and decoding JSON streams

Example:

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

lib.rs:

Library for decoding and encoding JSON streams.

Example:

# use futures::StreamExt;
# use futures::executor::block_on;
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.

Dependencies

~1.5–6.5MB
~105K SLoC