pub enum JsonValue {
Null,
Bool(bool),
Number(f64),
String(String),
Array(Vec<JsonValue>),
Object(Vec<(String, JsonValue)>),
}Expand description
Simplified JSON value representation.
Variants§
Implementations§
Source§impl JsonValue
impl JsonValue
Sourcepub fn as_array_mut(&mut self) -> Option<&mut Vec<JsonValue>>
pub fn as_array_mut(&mut self) -> Option<&mut Vec<JsonValue>>
Returns the value as mutable array.
Sourcepub fn as_object(&self) -> Option<&[(String, JsonValue)]>
pub fn as_object(&self) -> Option<&[(String, JsonValue)]>
Returns the object entries if the value is an object.
Sourcepub fn as_object_mut(&mut self) -> Option<&mut Vec<(String, JsonValue)>>
pub fn as_object_mut(&mut self) -> Option<&mut Vec<(String, JsonValue)>>
Returns a mutable reference to the object entries.
Sourcepub fn get_mut(&mut self, key: &str) -> Option<&mut JsonValue>
pub fn get_mut(&mut self, key: &str) -> Option<&mut JsonValue>
Retrieves mutable field value from object by key.
Sourcepub fn object(entries: Vec<(String, JsonValue)>) -> JsonValue
pub fn object(entries: Vec<(String, JsonValue)>) -> JsonValue
Convenience constructor for JSON objects.
Sourcepub fn to_json_string(&self) -> String
👎Deprecated: Use crate::serde_json::Value::to_string_compact for boundary emission; see ADR 0010 / issue #177
pub fn to_json_string(&self) -> String
Use crate::serde_json::Value::to_string_compact for boundary emission; see ADR 0010 / issue #177
Serializes the value into a compact JSON string.
Deprecation note (ADR 0010 / issue #177): the canonical
JSON encoder for serialization-boundary-sensitive paths
(audit log, HelloAck, PayloadReply, anything reaching a
downstream parser) is crate::serde_json::Value::escape_string
using to_string_compact. This local encoder is correct after
the F-01 hotfix (#181) but is not the canonical owner; new
audit / wire emission code should not call it. Existing MCP
JSON-RPC callers may keep using it pending a follow-up
retirement slice.