When a large set of JSON object is cast to Java Object using ObjectMapper throws java.lang.OutOfMemoryError: GC overhead limit exceeded
. Find the code snippets here
(List<ClassA>) JSONUtils.toObjectList(responseEntity.getBody(), new TypeReference<List<ClassA>>() {})
public class JSONUtils {
...
private static final ObjectMapper jsonToObjectListMapper = new ObjectMapper();
...
public static Object toObjectList(String json, TypeReference<?> type) {
Object obj = null;
try {
obj = jsonToObjectListMapper.readValue(json, type);
}
catch (Exception e) {
throw e;
}
return obj;
}
...
}
Is there any other solution that means any library which can efficiently parse JSON?