forma_json
JSON serializer and deserializer for the forma serialization framework.
Most users should use forma with the json feature instead of depending on
this crate directly:
[]
= { = "0.1", = ["derive", "json"] }
Quick Example
use ;
// Serialize to JSON
let json = to_string.unwrap;
let pretty = to_string_pretty.unwrap;
// Deserialize from JSON
let v: MyStruct = from_str.unwrap;
// Dynamic Value type
let val: Value = from_str.unwrap;
assert_eq!;
API
to_string/to_string_pretty-- serialize to a JSON string.to_vec/to_writer-- serialize to bytes or anio::Write.from_str/from_slice-- deserialize from a string or byte slice.Value-- dynamic JSON type withIndexsupport for convenient access.to_value/from_value-- convert between typed values andValue.
Lenient Mode
The deserializer accepts standard JSON. Lenient extensions (trailing commas, comments) may be added in a future release behind a feature flag.
License
Licensed under either of Apache License, Version 2.0 or MIT License at your option.