I want to add an object to a specific position in JSonArray.
My Current JsonArray look like this
JSONArray is not meant as a general-purpuse data structure, but to (de)serialize data to and from JSON. Therefore, you should do all add/remove/mutate operations on a
java.util.List or something and only if you want to send it over the wire convert to a
Java EE 7 also has a
JsonArray class, in their API description they make abundantly clear that they want to prevent people from using it as a replacement for a
JsonArray instances are list objects that provide read-only access to the values in the JSON array. Any attempt to modify the list, whether directly or using its collection views, results in an UnsupportedOperationException.
See also this answer