0
//String representation of an array/list with two JSON string representations inside of it
String arrayOfTwoJSONString = "[{\"a\": \"sampleA\", \"b\": \"sampleB\"}, {\"c\": \"sampleC\", \"d\": \"sampleD\"}]";

How can I convert this to an Array or ArrayList that contains two String representations of the JSONs?

Federico klez Culloca
  • 26,308
  • 17
  • 56
  • 95
  • any reason you want to split this to an array of String and not convert it directly to an array of map ? in other word, parse the JSon – jhamon Sep 08 '22 at 14:15
  • You can try with this approach String arrayOfTwoJSONString = "[{\"a\": \"sampleA\", \"b\": \"sampleB\"}, {\"c\": \"sampleC\", \"d\": \"sampleD\"}]"; List of = List.of(arrayOfTwoJSONString.split(",")); of.stream().forEach(System.out::println); – Mukesh Sep 08 '22 at 15:03

0 Answers0