Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7807229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:47:18+00:00 2026-06-02T02:47:18+00:00

Sorry for the title, I explain. I’m developing an Android app that use a

  • 0

Sorry for the title, I explain.

I’m developing an Android app that use a WebService on Google App Engine.
In my WebService I’ve an ArrayList converted in JSON trough JAX-RS, and the final JSON is something like

{ “lessons” : [ { “name” : “blabla”, “prof”:”Tom” }, { “name” :
“blabla”, “prof”:”Tom” } ] }

Is this practical or is there a better way?

Then I fetch this JSON from the Android app and convert it in a JSONObject with a snipplet found online:

DefaultHttpClient defaultClient = new DefaultHttpClient();

HttpGet httpGetRequest = new HttpGet(s);

HttpResponse httpResponse = defaultClient.execute(httpGetRequest);

BufferedReader reader = new BufferedReader(new
InputStreamReader(httpResponse.getEntity().getContent(), “UTF-8”));

String json = reader.readLine();

JSONObject jsonObject = new JSONObject(json);

How can I get back to my ArrayList?

I’ve read tons of code and tried to use Gson…
This should be easy but I’ve lost an entire day yesterday..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T02:47:20+00:00Added an answer on June 2, 2026 at 2:47 am
      private class Info {
            public String name;
            public String prof;
        }
    
        ArrayList<Info> arrayList = new ArrayList<Info>();
    
        JSONArray array = jsonObject.optJSONArray("lessons");
        int len = array.length();
    
        for (int i = 0; i < len ; i++) {
         JSONObject tmp = array.optJSONObject(i);
         Info info = new Info();
         info.name = tmp.optString("name");
         info.prof = tmp.optString("prof");
          arrayList.add(info)
    }
    

    check for mispelling error

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry if that title didn't explain it well. Here is the table... (source: alexanderdickson.com
Sorry if my title is hard to understand. Let me explain. To use this
Sorry for the title not really sure how to explain it being that I
sorry for that title but it is very hard to explain in a few
Sorry for the unhelpful title, but hopefully I can explain this well enough. Lets
Sorry if the post title wasn't clear, I will try to explain a little
Sorry for the vague title, as I really can't explain this problem succinctly. Basically
sorry for the confusing title, its really hard for me to explain what i
Sorry if the question title is confusing. Let me explain further. I am building
I'm sorry if my question title seems fundamentally uninformed. Let me explain what I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.