I am using c# and json.net 9.0.1
I have the following json
{
"lineups": [
{
"55": {
"id": "55",
"game_id": "1",
"player_id": "55",
"jersey_number": "78"
},
"56": {
"id": "56",
"game_id": "1",
"player_id": "56",
"jersey_number": "77"
},
"57": {
"id": "57",
"game_id": "1",
"player_id": "57",
"jersey_number": "76"
}
}
]
}
All of the array items are of type Player. How can I parse the json so that each item "55", "56", "57" are stored in a list of Players, List?
The source json can't be modified as it is coming from a 3rd party.
UPDATE Modified the json to be valid,
Dictionary<string,Player>where your keys55,56, etc will become the keys in the dictionary.{inside the lineups array, but no corresponding closing) Do you really need to parse malformed JSON, or is the example bad? Please edit the question to clarify.