I have a JSONObject and I need to place inside a JSONArray.
This is my code:
ArrayList<Map<String, String>> Data = new ArrayList<>();
Map<String,String> element1 = new HashMap<>();
String JSONString = "{\"optGroups\":{\"Information\":{\"optStatus\":false,\"updateDate\":\"01/03/2017 01:16:03\"},\"freeToUse\":{\"optStatus\":false,\"updateDate\":\"01/03/2017 01:16:03\"}},\"optInsights\":{\"RemindPaymentTransfer\":{\"optStatus\":false,\"updateDate\":\"01/03/2017 01:16:03\"},\"BalanceIsTooLow\":{\"optStatus\":false,\"updateDate\":\"01/03/2017 01:16:03\"}}}";
element1.put("key1",JSONString);
Data.add(element1);
return new JSONArray(Data);
When I print the JSONArray I see the original String with "\" symbols.
How to fix the formatting so I will keep the JSONArray but see a valid JSONObject with "key":"value"?