Skip to main content

Module json

Module json 

Source
Expand description

JSON: text in, text out.

The entry points here are re-exported at the crate root, since JSON is the format most callers reach for first. structio::from_str and structio::json::from_str are the same function.

For the binary format that reads and writes the same structs, see beve.

Re-exports§

pub use impls::FromJsonKey;
pub use impls::ToJsonKey;
pub use minify::minify;
pub use minify::minify_into;
pub use minify::minify_into_with;
pub use minify::minify_with;
pub use parser::JsonStr;
pub use parser::Parser;
pub use prettify::prettify;
pub use prettify::prettify_into;
pub use prettify::prettify_into_with;
pub use prettify::prettify_with;
pub use stream::Documents;
pub use stream::Feed;
pub use stream::Iter;
pub use stream::Mode;
pub use stream::from_reader;
pub use stream::from_reader_with;
pub use stream::to_writer;
pub use stream::to_writer_buffered;
pub use stream::to_writer_buffered_with;
pub use stream::to_writer_with;
pub use writer::Writer;
pub use writer::quoted_key;

Modules§

impls
Read and Write for the standard library’s types.
minify
Taking the whitespace back out of JSON text.
parser
The parse cursor.
prettify
Laying out JSON text that is already JSON.
stream
Reading and writing JSON that does not fit, or has not arrived.
writer
The output buffer.

Traits§

Read
A type that can be parsed from JSON.
ReadArray
Element-by-element reading for a struct written as a JSON array.
ReadAs
How a field of type T is read when its declaration names this adapter.
ReadEnum
Variant-by-variant reading for an enum.
ReadKeyAs
How a map key of type T is read when its declaration names this adapter.
ReadObject
Field-by-field reading for a struct.
ReadWrite
Convenience bound for generic containers: readable from any JSON input, and writable.
Write
A type that can be serialized to JSON.
WriteArray
Element-by-element writing for a struct written as a JSON array.
WriteAs
How a field of type T is written when its declaration names this adapter.
WriteKeyAs
How a map key of type T is written when its declaration names this adapter.
WriteObject
Field-by-field writing for a struct.

Functions§

from_slice
Parse a JSON document given as bytes.
from_slice_with
from_slice under an explicit read policy.
from_str
Parse a JSON document into a new value.
from_str_with
from_str under an explicit read policy.
read_into
Parse a JSON document into an existing value.
read_into_with
read_into under an explicit read policy.
to_string
Serialize a value to a String.
to_string_with
to_string under an explicit write policy.
to_vec
Serialize to a byte vector.
to_vec_with
to_vec under an explicit write policy.
write_into
Serialize into an existing String, replacing its contents and keeping its allocation.
write_into_with
write_into under an explicit write policy.