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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:12:48+00:00 2026-06-17T21:12:48+00:00

i have this json: [{id:1,name:john},{id:2,name:jack},{id:3,name:terry}] how i can parse this? i have to use

  • 0

i have this json:

[{"id":"1","name":"john"},{"id":"2","name":"jack"},{"id":"3","name":"terry"}]

how i can parse this? i have to use a loop for extracting each group? for simple jsons i use this code:

    public static String parseJSONResponse(String jsonResponse) {

    try {

         JSONObject  json = new JSONObject(jsonResponse);

           // get name & id here
         String  name = json.getString("name");
         String  id =  json.getString("id");

    } catch (JSONException e) {

        e.printStackTrace();
    }

    return name;
}

but now i have to parse my new json. please help me

  • 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-17T21:12:50+00:00Added an answer on June 17, 2026 at 9:12 pm

    It should be like this:

    public static String parseJSONResponse(String jsonResponse) {
    
    try {
    
        JSONArray jsonArray = new JSONArray(jsonResponse);
    
        for (int index = 0; index < jsonArray.length(); index++) {
            JSONObject  json = jsonArray.getJSONObject(index);
    
            // get name & id here
            String  name = json.getString("name");
            String  id =  json.getString("id");
        } 
    
    
    
    } catch (JSONException e) {
    
        e.printStackTrace();
    }
    
    return name;
    }
    

    Of course you should return an array of names or whatever you want..

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

Sidebar

Related Questions

i have this json : {id:1,name:john smith} How i can parse it? i know
I have this array: $json = json_decode(' {entries:[ {id: 29,name:John, age:36}, {id: 30,name:Jack, age:23}
I have a JSON like this { id:1, name:Jack, parent.id:2 } Note the dot
I have this json array: var a = [{results:[{id:25,name:John,age:46},{id:41,name:Sonny,age:31}],count:2,total:14}]; It contains an array called
i have an json array like this //data.json { one: [ {name:john},{name:joe},{name:vicky} ], two:
I have JSON documents of this type: { name : 'John', age : 30,
I have this JSON data: var people = [ { name : John, age
I have a single array json string containing data: [{Name:John,Age:22}, {Name:Jack,Age:56}, {Name:John,Age:82}, {Name:Jack,Age:95}] I
I have some JSON data that looks like this: { data: [{ name:John Smith,
I have a JSON structure like this: { id:100 contactInfo: { name: John Doe

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.