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 8048457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:26:40+00:00 2026-06-05T06:26:40+00:00

I can parse the simple JSON string using the following code HttpClient client =

  • 0

I can parse the simple JSON string using the following code

HttpClient client = new DefaultHttpClient();
    HttpGet httpGet = new HttpGet(
            URL.toString() );




    try {
        HttpResponse response = client.execute(httpGet);
        StatusLine statusLine = response.getStatusLine();
        int statusCode = statusLine.getStatusCode();
        if (statusCode == 200) {
            HttpEntity entity = response.getEntity();
            InputStream content = entity.getContent();
            BufferedReader reader = new BufferedReader(
                    new InputStreamReader(content));

            finalResult.setText("Done") ;

            Result = reader.readLine();


        } else {
             Result = "error";
        }
    } catch (ClientProtocolException e) {
         Result = "error";
        e.printStackTrace();
    } catch (IOException e) {
         Result = "error";
        e.printStackTrace();
    }

but now I have the following JSON string

[{"Name":"Ali" ,"Age":35,"Address":"cccccccccccc"} ,{"Name":"Ali1" ,"Age":351,"Address":"cccccccccccc1"} ,
{"Name":"Ali2" ,"Age":352,"Address":"cccccccccccc2"}
]

and class represent it

package com.appnetics;

import android.R.string;

public class Encounter {
    public string Name;
    public string Address;
    public int Age;
}

I want to loop through this JSON and convert it to list<Encounter>

any idea how to do that

  • 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-05T06:26:42+00:00Added an answer on June 5, 2026 at 6:26 am

    Use the org.json namespace. For your concrete example you can do:

    ArrayList<Encounter> encounters=new ArrayList<Encounter>();
    JSONArray array=new JSONArray(Result);
    for(int i=0;i<array.length();i++){
        JSONObject elem=(JSONObject)array.get(i);
        Encounter encounter=new Encounter();
        Encounter.Name=elem.getString("Name");
        Encounter.Age=elem.getInt("Age");
        Encounter.Address=elem.getString("Address");
        encounters.add(encounter);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider I have a JSON string of the following format: How do I parse
I'm trying to parse a simple JSON file. I'm very new to javascript, JSON,
I'm trying to parse a simple JSON file. I'm very new to javascript, JSON,
I want to parse JSON arrays and using gson. Firstly, I can log JSON
I'm trying to parse a simple JSON string, but I'm not used to do
I am reading JSON code from the database and then parsing the string using
I have a simple call JSON.parse(Panda.get(/videos/#{self.panda_video_id}/encodings.json)) Which returns : can't convert Array into String
This is only tangentially a programming question. Where can I find a simple-to-parse list
How i can parse and extract the parameters from an SQL Query using delphi?
I'm using RSS library so i can parse Atom and RSS in Ruby and

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.