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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:21:01+00:00 2026-06-17T20:21:01+00:00

i have this json : {id:1,name:john smith} How i can parse it? i know

  • 0

i have this json : {"id":1,"name":"john smith"}

How i can parse it? i know i have to do this with this function:

public static String parseJSONResponse(String jsonResponse) {
    String name = "";
    JSONObject json;
    try {
        json = new JSONObject(jsonResponse);
        JSONObject result = json.getJSONObject("**********");
        name = result.getString("**********");

    } catch (JSONException e) {

        e.printStackTrace();
    }

    return name;
}

but i dont know what can i put in the areas incated with “****“. please help me

i only want to fetch id and name values.

  • 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-17T20:21:02+00:00Added an answer on June 17, 2026 at 8:21 pm

    use this method to parse your JSON String

    public static String parseJSONResponse(String jsonResponse) {
    
        try {
    
             JSONObject  json = new JSONObject(jsonResponse);
    
               // get name & id here
             String  name = json.getString("name");
             int id =  json.getInt("id"); 
    
        } catch (JSONException e) {
    
            e.printStackTrace();
        }
    
        return name;
    }
    

    For more Refer this Link

    • 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},{id:2,name:jack},{id:3,name:terry}] how i can parse this? i have to use
I have some JSON data that looks like this: { data: [{ name:John Smith,
I have sample data in this form: { ID:2 Type:None Reference1:6369-545.1 Reference2:6369-545.2 Name:John Smith
i have an json array like this //data.json { one: [ {name:john},{name:joe},{name:vicky} ], two:
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 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 a JSON structure like this: { id:100 contactInfo: { name: John Doe
I have this json code: { data: [ { name: John, id: 11 },

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.