Serde_json::from_str on a string with multiple json objects

#1

I have a line of code:

    let v: Value = serde_json::from_str(&contents).expect("json parse fail");

This fails when contents contains more than one json vaule – a series of them, separated by \n's.

Question: how do I read a LIST of VALUE instead of a single VALUE ?

#2

https://docs.rs/serde_json/1.0.36/serde_json/de/struct.StreamDeserializer.html

1 Like
#3

@vorner : StreamDeserializer is precisely what I needed. Thanks!