How to deserialize a JSON input as a generic datastructure in Rust?
Most examples showing deserialization of JSON with Rust and serde_json
show deserialization into a known structure format, using a defined struct
.
Getting a error trying to read and write to json in Rust
I’m new to rust and decided to throw myself in the deep end. So I’m currently making a notes taking app in the terminal, and I want to save the notes in json format. But I keep getting this error:
Deserialize json array into existing Vec
I have some function, here called request
, that returns a JSON string with some data. For example, an array with variable size. I can deserialize the JSON string into a Vec just fine with serde_json
, but I have to call the request
many times. I would like instead to reuse the Vec already created, instead of dropping and creating a new Vec every time deserialization happens.