sval_json
A no-std JSON implementation for the sval
serialization framework.
sval_json
is mostly pilfered from dtolnay's excellent miniserde
project.
rustc
This library requires Rust 1.31.0
.
sval_json
has the following optional features that can be enabled in your Cargo.toml
:
std
: assume std
is available and add support for std
types.Add sval_json
to your crate dependencies:
toml
[dependencies.sval_json]
version = "0.4.0"
fmt::Write
rust
let json = sval_json::to_fmt(MyWrite, 42)?;
String
Add the std
feature to your Cargo.toml
to enable writing to a String
:
toml
[dependencies.sval_json]
features = ["std"]
rust
let json = sval_json::to_string(42)?;
io::Write
Add the std
feature to your Cargo.toml
to enable writing to an io::Write
:
toml
[dependencies.sval_json]
features = ["std"]
rust
let json = sval_json::to_writer(MyWrite, 42)?;