0

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.

ashish gupta
  • 135
  • 5
  • 16
  • Does this answer your question? [Parsing JSON in Java without knowing JSON format](https://stackoverflow.com/questions/19760138/parsing-json-in-java-without-knowing-json-format) – Miss Skooter Feb 17 '23 at 08:48

0 Answers0