I am consuming a Rest API and I am getting multiple Json structure as the API response for different-different use cases.
so, below are the 3 Json format structure.
1.
{
"error":"ash",
"error_description" : "gupta",
"id":"123"
}
2.
"service_response":[
{
"message":"column",
"errorCode":"Invalid_code"
}
]
3. {
"id":"ash",
"success" : "gupta",
"errors":[]
}
I am not able to write the code for different - different Json structure. I am getting parsing exception because I have handled one response. but the problem is how can we identify that which response structure we have to parse.