Type Alias Json

View as Markdown

Generated from cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-ffi.

pub type Json = Value;

JSON value alias used by adaptive metadata payloads.

Aliased Type

pub enum Json {
    Null,
    Bool(bool),
    Number(Number),
    String(String),
    Array(Vec<Value>),
    Object(Map<String, Value>),
}

Variants

Null

Null

Represents a JSON null value.

1let v = json!(null);

Bool(bool)

Bool(bool)

Represents a JSON boolean.

1let v = json!(true);

Number(Number)

Number(Number)

Represents a JSON number, whether integer or floating point.

1let v = json!(12.5);

String(String)

String(String)

Represents a JSON string.

1let v = json!("a string");

Array(Vec<Value>)

Array(Vec<Value>)

Represents a JSON array.

1let v = json!(["an", "array"]);

Object(Map<String, Value>)

Object(Map<String, 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.

1let v = json!({ "an": "object" });