Function jsonc_to_json::jsonc_to_json_into
source · pub fn jsonc_to_json_into(jsonc: &str, json: &mut String)
Expand description
Same as jsonc_to_json()
, but instead of allocating a
new String
, then the output JSON is appended to json
.
Note: The output JSON is appended to json
, i.e. if json
is not empty, then call clear()
beforehand.
See jsonc_to_json()
for more information.
Example
See also serde_json
example in crate root docs.
let jsonc = "{\"arr\": [1, 2,/* Comment */ 3, 4,,]}// Line Comment";
let mut json = String::new();
jsonc_to_json_into(jsonc, &mut json);
println!("{}", json);
Which outputs the following:
{"arr": [1, 2, 3, 4]}