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

The Archive Base Latest Questions

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

I am working on an Android project and my json strings are a bit

  • 0

I am working on an Android project and my json strings are a bit strange, all of the tutorials are showing that I need to parse an JSONArray but my JSON has no array name.
Heres an example json url. (my understanding says that there needs to be something like “article” before the [

 [
 ///Something should be here
 {
    "id": 15483,
    "title": "Bilbo Baggins is Cool",
    "permalink": "http://example.com/2012/12/03/",
     "content": "Hello World",
    "date": "2012-12-03 00:04:08",
    "author": "Bilbo Baggins",
    "thumbnail": "http://example.com/wp-        content/uploads/2012/12/DSC02971.jpg",
    "categories": [
        "News"
    ],
    "tags": [
        "LOTR",
        "One Ring",
        "Patch",
        "Police Department"
    ]
}
]

Like this example http://www.androidhive.info/2012/01/android-json-parsing-tutorial/
They have a tag at the beginning called “contacts” which lets him use a JSONArray to loop through all the contents and get the tags…
I am lost.
How can I parse this data? the tutorial code would not work as I cannot pull an array(as least i think).

  • 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:28:32+00:00Added an answer on June 17, 2026 at 9:28 pm
     I am lost
    

    First of all,I would like to tell you that in the example of androidhive,the root element of jsonstring is the jsonobject and the root element of jsonstring which you posted as question is the jsonarray.
    Second of all,It’s not necessary to always have a name at the beginning of array to consume it and extract data from it.but yes,it surely requires in complex cases and it is good practice too.

    How can I parse this data?
    

    the root element is different,so you need to change the way of consuming the data,

    in example of androidhive,

        // Creating JSON Parser instance
    JSONParser jParser = new JSONParser();
    
    // getting JSON string from URL
    JSONObject json = jParser.getJSONFromUrl(url); //look at the left side of assignment operator.here result is being consumed in JSONObject
    
    try {
        // Getting Array of Contacts
        contacts = json.getJSONArray(TAG_CONTACTS);
    
        // looping through All Contacts
        for(int i = 0; i < contacts.length(); i++){
            JSONObject c = contacts.getJSONObject(i);
    
            // Storing each json item in variable
            String id = c.getString(TAG_ID);
            String name = c.getString(TAG_NAME);
            String email = c.getString(TAG_EMAIL);
            String address = c.getString(TAG_ADDRESS);
            String gender = c.getString(TAG_GENDER);
    
            // Phone number is agin JSON Object
            JSONObject phone = c.getJSONObject(TAG_PHONE);
            String mobile = phone.getString(TAG_PHONE_MOBILE);
            String home = phone.getString(TAG_PHONE_HOME);
            String office = phone.getString(TAG_PHONE_OFFICE);
    
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
    

    the jsonstring which you posted as question can be consumed in JSONArray,

        // Creating JSON Parser instance
    JSONParser jParser = new JSONParser();
    
    // getting JSON string from URL
    JSONArray json = jParser.getJSONFromUrl(url); //look at the left side of assignment operator.here result is being consumed in JSONArray
    
    try {
        // looping through All data
        for(int i = 0; i < json.length(); i++){
            JSONObject c = json.getJSONObject(i);
    
            // Storing each item in variable
            String id = c.getString("id");
            String title= c.getString("title");
            String permalink= c.getString("permalink");
            String content= c.getString("content");
    
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on an Android project in that i need to send the
I am working on a Android project. I need a small help in that.
I'm working on an Android project that focuses on knowing how close you are
maybe you can help me out. I'm working on an Android app project that
I was working on an android project, and while designing i noticed something strange
I'm working in a android project the idea is simple: I just need to
I had a working android project but needed to start from scratch. I copied
I am working on android project and I need to perform a like query
I am working in android.In my project there is a JSON parsing field for
I am currently working on an android project that requires me to invoke a

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.