pub enum JsonValue {
Null,
Boolean(bool),
Number(JsonNumber),
String(String),
Array(Vec<JsonValue>),
Object(BTreeMap<String, JsonValue>),
}Expand description
A native Rust representation of any valid JSON value.
This enum is used by the stringify functions to serialize
Rust data into a JSON string.
Variants§
Null
Represents a JSON null.
Boolean(bool)
Represents a JSON true or false.
Number(JsonNumber)
Represents a JSON number.
String(String)
Represents a JSON string.
Array(Vec<JsonValue>)
Represents a JSON array (list).
Object(BTreeMap<String, JsonValue>)
Represents a JSON object (map). We use BTreeMap to guarantee deterministic (alphabetical) key order during serialization.
Implementations§
Source§impl JsonValue
impl JsonValue
Sourcepub fn parse(input: &str) -> Result<JsonValue, ParseError>
pub fn parse(input: &str) -> Result<JsonValue, ParseError>
Parses a JSON string into a JsonValue.
This function builds an in-memory JsonValue from the input string.
For large inputs, using the parse_streaming iterator is more memory-efficient.
§Errors
Returns a ParseError if the JSON is invalid, empty, or has trailing tokens.
Trait Implementations§
impl StructuralPartialEq for JsonValue
Auto Trait Implementations§
impl Freeze for JsonValue
impl RefUnwindSafe for JsonValue
impl Send for JsonValue
impl Sync for JsonValue
impl Unpin for JsonValue
impl UnwindSafe for JsonValue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more