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

  • Home
  • SEARCH
  • 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 8001959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:14:04+00:00 2026-06-04T16:14:04+00:00

I want to retrieve JSON from a web-service and parse it then. Am I

  • 0

I want to retrieve JSON from a web-service and parse it then.
Am I on the right way?

    HttpClient httpclient = new DefaultHttpClient();
    HttpGet httpget = new HttpGet(url);
    HttpResponse response;
    try {
        response = httpclient.execute(httpget);
        HttpEntity entity = response.getEntity();

        if (entity != null) {
           // parsing JSON
        }

    } catch (Exception e) {
    }

Unfortunately I don’t know how to convert HttpEntity into a JSONObject.

This is my JSON (extract):

{
    "names": [
        {
            "name": "Zachary"
        },
        {
            "name": "Wyatt"
        },
        {
            "name": "William"
        }
    ]
}
  • 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-04T16:14:06+00:00Added an answer on June 4, 2026 at 4:14 pm

    You can convert string to json as:

    try {
            response = httpclient.execute(httpget);
            HttpEntity entity = response.getEntity();
    
            if (entity != null) {
               String retSrc = EntityUtils.toString(entity); 
               // parsing JSON
               JSONObject result = new JSONObject(retSrc); //Convert String to JSON Object
    
                 JSONArray tokenList = result.getJSONArray("names");
                 JSONObject oj = tokenList.getJSONObject(0);
                 String token = oj.getString("name"); 
            }
    }
     catch (Exception e) {
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a webpage that uses JavaScript to retrieve JSON from a web service.
I want to retrieve the moth from a date(in textbox),then If that retrieved month
I want to retrieve the JSON from http://www.bartdekimpe.be/anoire/index.php/admin/getGamesUserJson/34 but I can't seem to get
For a specific requirement in my project, I want to retrieve JSON response from
I want to retrieve information from my Stack Overflow profile as JSON using the
As the title says, i want to retrieve my Json data values from a
I want to split the json part from this URL in my iPhone application.
I want to be able to Ajax-ly retrieve JSON data from some kind of
I'm building an app that retrieve JSON from URL. At first, I used emulator,
I have a HTML table as follows. I want retrieve row values from this

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.