How can I deserialise JSON {"arr":[1,2,3,4]} without performing a heap allocation using serde_json_core or similar? It performs one allocation currently. I see serde_json_core uses the heapless crate but I am unsure exactly how to make them work together.
#[derive(Deserialize)]
struct MyStruct {
arr: Vec<u64>,
}
fn main() {
let j = r#"{"arr":[1,2,3,4]}"#;
let r: serde_json_core::de::Result<(MyStruct, usize)> = serde_json_core::from_str(j);
let (out, _) = r.unwrap();
println!("First value: {}.", out.arr[0]);
}
I am using serde_json_core = 0.4.0.