I want to create a JSON Object using String.
Example : JSON {\"test1\":\"value1\",\"test2\":{\"id\":0,\"name\":\"testName\"}}
{\"test1\":\"value1\",\"test2\":{\"id\":0,\"name\":\"testName\"}}
In order to creat
In contrast to what the accepted answer proposes, the documentation says that for JSONArray() you must use put(value) no add(value).
put(value)
add(value)
https://developer.android.com/reference/org/json/JSONArray.html#put(java.lang.Object)
(Android API 19-27. Kotlin 1.2.50)