I don't get it, this is not valid JSON.
Rust
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Wormhole
Credits
- The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)
It should be wrapped in an array, not an object. Then it's valid. The problem was that I was trying to use an enum.
So, no. With the way you have it setup right now you would need to adjust your JSON structure to have the nation info be under a key, as well as the people array.
{
"Nation": {...},
"People": [...],
}
Every value has to have a key, unless it is the only value being serialized.
[1,2]
Is valid JSON, but
{ {"Id":1} }
Is not
This is not valid JSON.
What are you deserializing into? Minimum reproducible Code would be best. That means a main.rs file with a main method and no dependencies, which prints your error when run. Then you can simply share it on the rust playground or ideone.com.
I believe the JSON you have given us is invalid. Either the outer most parentheses must be [] instead of {}, or the nation and the list must get a name, i.e. "nation" = {"id"= 1, "country"="USA"}, "people"= []