Struct serde_json::builder::ObjectBuilder [] [src]

pub struct ObjectBuilder {
    // some fields omitted
}

This structure provides a simple interface for constructing a JSON object.

Methods

impl ObjectBuilder

fn new() -> ObjectBuilder

Construct an ObjectBuilder.

fn unwrap(self) -> Value

Return the constructed Value.

fn insert<S, V>(self, key: S, value: V) -> ObjectBuilder where S: Into<String>, V: Serialize

Insert a key-value pair into the object.

fn insert_array<S, F>(self, key: S, f: F) -> ObjectBuilder where S: Into<String>, F: FnOnce(ArrayBuilder) -> ArrayBuilder

Creates and passes an ObjectBuilder into a closure, then inserts the resulting array into this object.

fn insert_object<S, F>(self, key: S, f: F) -> ObjectBuilder where S: Into<String>, F: FnOnce(ObjectBuilder) -> ObjectBuilder

Creates and passes an ObjectBuilder into a closure, then inserts the resulting object into this object.