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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T04:52:52+00:00 2026-05-19T04:52:52+00:00

I can take json object like this : {title:this i the title, description:this is

  • 0

I can take json object like this :

{"title":"this i the title", "description":"this is the description"}

or even json array : data[{"title":"ABCD","name":"Peter"}]

but how can I take :

  {"meta":{"total_rows":1,"uri":"\/profile\/info\/","limit":150,"limit_type":"user",
"requests":2,"reset":3063,"recorded":"2010-12-27 22:48:49"}}

for example I want to take the limit, what should I do ?

This is the class where I can take json data on internet

public class Connection2 {  
    float rating;
String name,air_day,network,air_time,description;

  public Connection2(String url){
        connect_show_info(url);     
    }
    public String returnName(){
        return name;
    }
    private void connect_show_info(String url){  


    // Create the httpclient  
    HttpClient httpclient = new DefaultHttpClient();  

    // Prepare a request object  
    HttpGet httpget = new HttpGet(url);   

    // Execute the request  
    HttpResponse response;  

    // return string  
    String returnString = null;  

    try {  

        // Open the webpage.  
        response = httpclient.execute(httpget);  

        if(response.getStatusLine().getStatusCode() == 200){  
            // Connection was established. Get the content.   

            HttpEntity entity = response.getEntity();  
            // If the response does not enclose an entity, there is no need  
            // to worry about connection release  

            if (entity != null) {  
                // A Simple JSON Response Read  
                InputStream instream = entity.getContent();  

                // Load the requested page converted to a string into a JSONObject.  
                JSONObject json = new JSONObject(convertStreamToString(instream));  

                // Get the query value'  
                String query = json.getString("meta");  

                // Make array of the suggestions
                JSONObject series = json.getJSONObject("series");                    
                // Build the return string.
               // Strings
                air_day = "monday";

                name = series.getString("name");
                //air_day = series.getJSONObject(0).getString("air_day").toString() ;
                //air_time = series.getJSONObject(0).getString("air_time").toString() ;
                //network = series.getJSONObject(0).getString("network").toString();
                //description = series.getJSONObject(0).getString("description").toString();
                // Int

                // Float
                //rating = (float) series.getJSONObject(0).optDouble("rating");


                // Cose the stream.  
                instream.close();  
            }  
        }  
        else {  
            // code here for a response othet than 200.  A response 200 means the webpage was ok  
            // Other codes include 404 - not found, 301 - redirect etc...  
            // Display the response line.  
            returnString = "Unable to load page - " + response.getStatusLine();  
        }  
    }  
    catch (IOException  ex) {  
        // thrown by line 80 - getContent();  
        // Connection was not established  
        returnString = "Connection failed; " + ex.getMessage();  
    }  
    catch (JSONException ex){  
        // JSON errors  
        returnString = "JSON failed; " + ex.getMessage();  
    }  
}

And this is the way I want to take it :

Connection2 serie = new Connection2(url);

    name = (TextView)findViewById(R.id.name);
    description = (TextView)findViewById(R.id.description);
    airday = (TextView)findViewById(R.id.air_day);
    airtime = (TextView)findViewById(R.id.air_time);

    name.setText(serie.returnName());
    description.setText(serie.description);
  • 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-05-19T04:52:52+00:00Added an answer on May 19, 2026 at 4:52 am

    Instead of writing lots of monkey code that org.json’s low-level JSON parser requires, I would recommend using one of data-binding capable JSON libs, like:

    • Jackson
    • Gson

    and define simple POJO structure, like:

    public class Response {
      public Meta meta;
    }
    
    public class Meta {
      public int total_rows;
      public String uri; // or could be URL or URI
      public int limit;
      public String limit_type; // or an Enum of { user, ... }
      public int requests;
      public int reset;
      public Data recorded;
    }
    

    and then use data binding, like:

    // Jackson; Gson uses 'Gson' object
    Response response = new ObjectMapper().readValue(json, Response.class);
    

    if you want to build requests (or other JSON), similarly you would just do

    byte[] jsonToSend = mapper.writeValueAsBytes(requestObject);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can i get the source code for a WAMP stack installer somewhere? Any help
I need to solve the following question which i can't get to work by
If all tables I want to delete from have the column gamer_id can i
I want to use a temp directory that will be unique to this build.
i have a input tag which is non editable, but some times i need
Every time that I want to do a Layout, I'm getting a black layout
I'm trying to build a C++ extension for python using swig. I've followed the
I'm in the process of porting some code from Linux to Mac OS X.
I have a new web app that is packaged as a WAR as part
We manage a site for a medical charity. They have a number of links

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.