0

I am working with a nasty API that returns complex JSON (more than 4200 lines) which includes multi dimensional arrays. Some Objects are repeated, in different locations of JSON. For example:

"User":{
         "$id": "9",
         "Code": "NU",
         "DisplayName": "My Name",
         "Experience": 2.41
       },

Is there an easy way to parse entire JSON file and find list of Users? Sometimes User is on the top level and sometimes it is nested in a four dimensional array.

DwB
  • 37,124
  • 11
  • 56
  • 82
Umami
  • 1
  • 1

1 Answers1

0

Short Answer

No, you will need to do work to achieve your goal.

Some Details

This problem is not hopeless. You can use an event-based JSON parser and ignore everything that is not related to the User object.

Here is a related Stack Overflow question with answers.

Also, try a google search for "json sax parser java" and you will find about a million links.

Another option might be to use JSON Xpaths. Try a google search for "json xpath java".

DwB
  • 37,124
  • 11
  • 56
  • 82