String jsonData = "[\r\n" +

" {\r\n" + " \"CompType\": \"Substrate\",\r\n" +

" \"CompName\": \"80101-106DSA\",\r\n" +

" \"CompRev\": \"BA\",\r\n" +

" },\r\n" +

" {\r\n" +

" \"CompType\": \"Substrate\",\r\n" +

" \"CompName\": \"80101-106JSA\",\r\n" +

" \"CompRev\": \"BA\",\r\n" +
" }\r\n" +

"]";

 

ObjectMapper mapper = new ObjectMapper();

 

List someListObject= mapper.readValue( jsonData, new TypeReference<List>() {});

 

for (SomeClass someClassObject : someListObject) 

System.out.println(someClassObject.toString());

// Re-build data into JSON array

JsonArrayBuilder jsonArrayBuilder=Json.createArrayBuilder();

for (SomeClass cd : lcd) {

jsonArrayBuilder.add(Json.createObjectBuilder()
.add("Comp_Type", cd.getType())
.add("Comp_Name", cd.getName())
.add("Comp_Rev", cd.getRevision())
}
JsonArray compJson=jsonArrayBuilder.build();

System.out.println(compJson.toString());