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"), Value::F64(1.0));
    map.insert(String::from("y"), Value::F64(2.0));
    let value = Value::Object(map);

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

Structs

Deserializer

Creates a serde::Deserializer from a json::Value object.

Serializer

Create a serde::Serializer that serializes a Serializee into a Value.

Enums

Value

Represents a JSON value

Traits

ToJson

A trait for converting values to JSON

Functions

from_value

Shortcut function to decode a JSON Value into a T

to_value

Shortcut function to encode a T into a JSON Value

Type Definitions

Map

Represents a key/value type.

MapIntoIter

Represents the IntoIter type.