Module json5
JSON5 parsing and serialization.
json5 provides parsing and serialization for the JSON5 format
using the serde framework.
JSON5 is a superset of JSON that allows comments,
trailing commas, unquoted keys, single-quoted strings,
and other conveniences that make it friendlier for hand-edited config files.
The main functions are from_str for deserialization
and to_string for serialization.
Examples
Deserializing a JSON5 config with comments and trailing commas:
use Deserialize;
let json5_str = "{
// server name
name: 'my-app',
port: 8080,
debug: true,
}";
let config: Config = from_str.unwrap;
assert_eq!;
assert_eq!;
assert!;
Serializing a struct to JSON5:
use Serialize;
let settings = Settings ;
let output = to_string.unwrap;
assert!;
assert!;