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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:06:04+00:00 2026-05-24T17:06:04+00:00

I’m trying to get the inner object of a json array (my jargon could

  • 0

I’m trying to get the inner object of a json array (my jargon could be incorrect) that looks like this:

{
"News": {
    "0": {
        "name": "nytimes",
        "fullName": "The New York Times",
        "text": "@OwenPerry We heard from the owner of the house and corrected the article http://t.co/8GEgGy7",
        "timestamp": "2011-08-15 12:20:36"
    },
    "1": {
        "name": "HuffingtonPost",
        "fullName": "Huffington Post",
        "text": "Look out! New Zealand Skier chased by angry bulls - http://t.co/L0PZkx4",
        "timestamp": "2011-08-15 12:19:04"
    }
}
}

My code to retrieve the inner objects looks like this:

        JSONArray category = json.getJSONArray("News");
        JSONArray innerobj = category.getJSONArray(0);
        for (int i = 0; i < innerobj.length(); i++) {
            HashMap<String, String> map = new HashMap<String, String>();
            JSONObject c = innerobj.getJSONObject(i);

            map.put("id", String.valueOf(i));
            map.put("name", c.getString("fullName") + "\n(#"
                    + c.getString("name") + ") ");
            map.put("text",
                    c.getString("text") + "\n - "
                            + c.getString("timestamp"));
            mylist.add(map);
        }

Any Ideas on what i’m doing incorrectly?

  • 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-24T17:06:04+00:00Added an answer on May 24, 2026 at 5:06 pm

    You don’t have JSONArray, but JSONObjects. Your JSONObject structure is:

    1. Main JSONObject, which contains 1 JSONObject – “news”
    2. “news” contains two JSONObjects, “0” and “1”
    3. Each of those objects have four fields – “name”, “fullname”, “text” and “timestamp”

    Consider:

    JSONObject jobj = new JSONObject(yourString);
    JSONObject newsobj = jobj.getJSONObject("news");
    JSONObject firstOne = newsobj.getJSONObject("0"); // this is the object "0"
    ....
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I'm trying to create an if statement in PHP that prevents a single post
I have some data like this: 1 2 3 4 5 9 2 6
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.