I am having a JSON Array which I am populating using a JSON object, and the code looks like this
Map<String, String> orderLines = new HashMap<>();
orderLines.put("xx",XX);
orderLines.put("yy",YY);
JSONObject obj=new JSONObject(orderLines);
JSONArray array = new JSONArray().put(obj);
and I am trying to add this array into my map and add it to the
Map<String, Object> customFields = new HashMap<>();
customFields.put("postOrderRequest.orderLines", array);
but when I am building a json out of these map values using
customFields.forEach((k, v) -> json.set(k, v));
, I am not able to build a json out of the map,what I am trying to achieve is something like this
{
"orderLines" : [{"xx":"XX","yy":"YY"}]
}