olpc-cjson
provides a serde_json::Formatter
to serialize data as canonical JSON, as defined by OLPC and used in TUF. It is developed as part of tough, a Rust library for using TUF repositories.
OLPC's canonical JSON specification is subtly different from other "canonical JSON" specifications, and is also not a strict subset of JSON (specifically, ASCII control characters 0x00–0x1f are printed literally, which is not valid JSON). Therefore, serde_json
cannot necessarily deserialize JSON produced by this formatter.
This crate is not developed or endorsed by OLPC; use of the term is solely to distinguish this specification of canonical JSON from other specifications of canonical JSON.
use CanonicalFormatter;
use Serialize;
use json;
let value = json!;
let mut buf = Vec new;
let mut ser = with_formatter;
value.serialize.unwrap;
assert_eq!;