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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:21:20+00:00 2026-06-06T07:21:20+00:00

I need the response to be converted to a string.. HttpClient httpclient = new

  • 0

I need the response to be converted to a string..

        HttpClient httpclient = new DefaultHttpClient();  
        Log.d("HTTP","Exe");
        String url=Sign(token);
        Log.d("HTTP","Exe");

        HttpPost httpPost;
        httpPost = new HttpPost(url);

The response(json) is supposed to be something like

{
    "url": "http://db.tt/APqhX1",
    "expires": "Tue, 01 Jan 2030 00:00:00 +0000"
}

how do i receive it?I am working on Android(java)..

  • 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-06T07:21:22+00:00Added an answer on June 6, 2026 at 7:21 am

    this is the way to get any json as a http response. I hope it would be usefull.

    HttpResponse response = httpclient.execute(httppost);
    HttpEntity entity = response.getEntity();
    InputStream is = entity.getContent();
    
    try {
         BufferedReader reader = new BufferedReader(new InputStreamReader(is, "utf-8"), 256);
     StringBuilder sb = new StringBuilder();
     String line = null;
     while ((line = reader.readLine()) != null)  sb.append(line); 
         result = sb.toString();
     is.close();
    } catch (Exception e) {}
    
     JSONArray jArray = new JSONArray(result);
     for(int i = 0; i < jArray.length(); i++) {
    JSONObject json_data = jArray.getJSONObject(i);
    String url= json_data.getString("url");
        String expires= json_data.getString("expires");
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to pass (via string content of a HTTP request/response body) name value
i need to get this url (http://localhost:8983/solr/select/?q=treen&omitHeader=true) and get the response as xml, and
I need to select some values from a json response. Im using json.net, fine
Essentially, I need to parse the response string of the CHAT CREATE command with
I'm making http requests using winsock and I need to parse the response. The
I have an array which is converted from an XML response. What I need
I need to convert a string to a JSON object that gets returned from
I'm using org.apache.commons.httpclient.HttpClient and need to setup response encoding (for some reason server returns
I need to improve the response time for a Grails application, so I need
I need to parse a response from a server like this: risposta: 200\n Len

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.