Function gron::json_to_gron
[−]
[src]
pub fn json_to_gron<W: Write, T: ToGron>(
out: &mut W,
prefix: &str,
json: &T
) -> Result<()>
Converts JSON structure from into gron format.
It works both on serde_json::Value
and on rustc_serialize::json::Json
Example
extern crate gron; extern crate serde_json; use std::io::stdout; use serde_json::value::Value; use serde_json::de; use gron::json_to_gron; let json: Value = de::from_str(r#"{"x": [1,2]}"#).unwrap(); json_to_gron(&mut stdout(), "val", &json); // Outputs to stdout: // // val = {} // val.x = [] // val.x[0] = 1 // val.x[1] = 2