Module serde_json::value [] [src]

JSON Value

This module is centered around the Value type, which can represent all possible JSON values.

Example of use:

extern crate serde_json;

use serde_json::Value;

fn main() {
    let s = "{\"x\": 1.0, \"y\": 2.0}";
    let value: Value = serde_json::from_str(s).unwrap();
}

It is also possible to deserialize from a Value type:

extern crate serde_json;

use serde_json::{Value, Map};

fn main() {
    let mut map = Map::new();
    map.insert(String::from("x"), 1.0.into());
    map.insert(String::from("y"), 2.0.into());
    let value = Value::Object(map);

    let map: Map<String, Value> = serde_json::from_value(value).unwrap();
}

Structs

Map

Represents a key/value type.

Number

Represents a JSON number, whether integer or floating point.

Enums

Value

Represents any valid JSON value.

Traits

ToJson

Representation of any serializable data as a serde_json::Value.

Functions

from_value

Interpret a serde_json::Value as an instance of type T.

to_value

Convert a T into serde_json::Value which is an enum that can represent any valid JSON data.