0

I have a zip file containing multiple json files. I have unzipped them then got POJO object from json using below code:

reader = new BufferedReader(new FileReader(file));
Gson gson = new GsonBuilder().create();
Element[] people = gson.fromJson(reader, Element[].class);

but I need to process these json files one by one using spring batch. Can someone help me how I can achieve this in spring batch and I want to read json file using chunk of 1000 My json object is very complex. Example:

{
    "students": {
      "subelements": {
          "dep": {
            "data": [
              "XYZ"
            ]
          }
        }
      }
}
R.Henderson
  • 74
  • 1
  • 9

1 Answers1

1

Your data structure is not one of the types you could handle with Spring Batch out-of-the-box. See more details here: https://stackoverflow.com/a/51933062/5019386.

So I think in your case, you would need to create a custom item reader to parse a specific fragment of your input file.

Mahmoud Ben Hassine
  • 28,519
  • 3
  • 32
  • 50