The library is chained, so you can create your object by first creating a json array, then creating the individual objects and adding them one at a time to the array, like so:
new JSONArray()
.put(new JSONObject()
.put("name", "cases")
.put("value", 23))
.put(new JSONObject()
.put("name", "revenue")
.put("value", 34))
.put(new JSONObject()
.put("name", "1D5")
.put("value", 56))
.put(new JSONObject()
.put("name", "diag")
.put("value", 14))
.toString();
Once you have the final array, call toString
on it to get the output.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…