I'm trying to send big string values (base64 formatted photo(s)) with android-networking library(OkHttp).
JSONObject jsonObj= new JSONObject();
JSONArray photosBase64JsonArray = new JSONArray();
for (String photoBase64:myPhotosBase64
) {
photosBase64JsonArray.put(photoBase64);
}
jsonObj.put("photos", photosBase64JsonArray);
AndroidNetworking.post(serverAddress)
.addJSONObjectBody(jsonObj)
.setPriority(Priority.IMMEDIATE)
.addHeaders("myHeader", "testing")
.build()
.getAsJSONObject()....
I'm getting this exception :
java.lang.StackOverflowError: stack size 8192KB
at java.lang.StringBuilder.append(StringBuilder.java:203)
at org.json.JSONStringer.string(JSONStringer.java:354)
at org.json.JSONStringer.value(JSONStringer.java:261)
at org.json.JSONObject.writeTo(JSONObject.java:733)
at org.json.JSONObject.toString(JSONObject.java:701)
at com.androidnetworking.common.ANRequest$PostRequestBuilder.addJSONObjectBody(ANRequest.java:1394)
How can I send very long string values?