Deserialize json to vec of struct

I am getting a json source from a web service that has a field with a value that is an array of records like so:

"mykey": [ 
        "foo": 1
        "bar": "stuff"
        "foo": 29,
        "bar": "other stuff"

I have a struct I'd like to deserialize that to with serde. My struct is

struct MyKey {
    mykey: Vec<FooBar>

struct FooBar {
    foo: i32,
    bar: String

I can't seem to get serde_json::from_str(&source) to work the way I expect.

That JSON isn't valid. You need a comma after "foo": 1.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.