pub type JsonValue = Value;
Expand description
A JSON-compatible dynamically-typed value.
Note: serde_json_bytes::Value
is similar
to serde_json::Value
but uses its reference-counted ByteString
for string values and map keys.
Aliased Type§
pub enum JsonValue {
Null,
Bool(bool),
Number(Number),
String(ByteString),
Array(Vec<Value>),
Object(Map<ByteString, Value>),
}
Variants§
Null
Represents a JSON null value.
let v = json!(null);
Bool(bool)
Represents a JSON boolean.
let v = json!(true);
Number(Number)
Represents a JSON number, whether integer or floating point.
let v = json!(12.5);
String(ByteString)
Represents a JSON string.
let v = json!("a string");
Array(Vec<Value>)
Represents a JSON array.
let v = json!(["an", "array"]);
Object(Map<ByteString, Value>)
Represents a JSON object.
By default the map is backed by a BTreeMap. Enable the preserve_order
feature of serde_json to use IndexMap instead, which preserves
entries in the order they are inserted into the map. In particular, this
allows JSON data to be deserialized into a Value and serialized to a
string while retaining the order of map keys in the input.
let v = json!({ "an": "object" });