Hello.
How to convert a Vec<serde_json::value::Value>
to a JSON string without structure declaration?
Input:
let v: Vec<serde_json::value::Value> =
vec![
serde_json::json!({"field": 1 as u8}),
serde_json::json!({"field": 2 as u8})
];
Output:
[{"field": 1}, {"field": 2}]
erelde
2
Have you tried :
serde_json::to_writer(std::io::stdout().lock(), &v);
// or
let s = serde_json::to_string(&v).unwrap();
playground
system
Closed
3
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.