I am new to J2EE and JSON. I am using jsonArray.put(jsonObject)
for adding a json object to a json array but its showing error message:
The method put(JSONObject) is undefined for the type JSONArray.
The library I am using for json is org.json.simple.*
Please help me out.
The method to put new stuff into an array is called add
. So:
jsonArray.add(jsonObject)
should work.
Please refer to the documentation for details.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.