I have a JSON response like the following
{
"result": "success",
"totalresults": "100",
"items": {
"item": [
{
"id": "5812",
"lineitems": {
"lineitem": [
{
"type": "product",
"status": "Active"
}
]
}
},
{
"id": "5",
"lineitems": []
}
]
}
}
While trying to deserialize this with a specific type it throws exception because of the lineitems property. lineitems is an empty array for one item and for the other item it has a property lineitem with an array. I don't have control over this JSON data. Please suggest me how to deserialize this without any error.
Using lineitems as object would help me to deserialize the JSON but then I'll end up having 2 different types in the object field which is not gonna help me either.