Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

491
Views
Why Getting StackOverflowError on with Big JsonObject?

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?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Used the Fast Android Networking with Jackson Parser and problem solved : )

implementation 'com.amitshekhar.android:jackson-android-networking:1.0.2'

AndroidNetworking.setParserFactory(new JacksonParserFactory());
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!