I'm working with an external API and the JSON error message it gives me in the response content is:
{
"errors": {
"items": {
"0": { <=== This being the index of the item that the error is in relation to
"id": [
{
"message": "invalid"
"code": "400"
}
]
}
}
}
}
How can i get the index value? I cant deserialise it and cast it to a model because the index value could be "2" or "5" or "19" but i need to get this value and because its an external API that returns this JSON I cannot change the structure of the data.
Any idea of how to achieve this using C# / .NET?
What i don't understand is how you get the key value of a nested object i guess.
Thanks