If a list has itself as an element JSONObject(list) causes stack overflow error as seen in following code:
List<List<?>> list = new LinkedList<>(); list.add(list); JSONObject j = new JSONObject(list);
If a list has itself as an element JSONObject(list) causes stack overflow error as seen in following code: