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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:39:02+00:00 2026-06-03T09:39:02+00:00

I have a problem to parse this JSON: { 850: { display-name: Volvo 850,

  • 0

I have a problem to parse this JSON:

{
  "850": {
    "display-name": "Volvo 850",
    "name-parts": {
      "make": "volvo",
      "model": "850"
    },
    "image": "http://images.thecarconnection.com/tmb/1997-volvo-850-lp_100026906_t.gif",
    "url": "http://www.thecarconnection.com/cars/volvo_850"
  },
  "960": {
    "display-name": "Volvo 960",
    "name-parts": {
      "make": "volvo",
      "model": "960"
    },
    "image": "http://images.thecarconnection.com/tmb/1997-volvo-960_100026908_t.gif",
    "url": "http://www.thecarconnection.com/cars/volvo_960"
  },
  "c30": {
    "display-name": "Volvo C30",
    "name-parts": {
      "make": "volvo",
      "model": "c30"
    },
    "image": "http://images.thecarconnection.com/tmb/2012-volvo-c30-2-door-coupe-auto-angular-front-exterior-view_100358956_t.gif",
    "url": "http://www.thecarconnection.com/cars/volvo_c30"
  },
  "c70": {
    "display-name": "Volvo C70",
    "name-parts": {
      "make": "volvo",
      "model": "c70"
    },
    "image": "http://images.thecarconnection.com/tmb/2012-volvo-c70_100369317_t.gif",
    "url": "http://www.thecarconnection.com/cars/volvo_c70"
  },
  "s40": {
    "display-name": "Volvo S40",
    "name-parts": {
      "make": "volvo",
      "model": "s40"
    },
    "image": "http://images.thecarconnection.com/tmb/2011-volvo-s40-4-door-sedan-angular-front-exterior-view_100329062_t.gif",
    "url": "http://www.thecarconnection.com/cars/volvo_s40"
  }
}

I am parsing the same like this:

try{
             JSONObject  jsonObj = new JSONObject(jsonString);

             System.out.println(jsonObj.length());
             JSONArray objNames = jsonObj.names();
             for(int i=0;i<objNames.length();i++)
             {
                 System.out.println("The Name:=========="+objNames.getString(i));
             }
             if(jsonObj.length()>0){

                    for (int index = 0; index < jsonObj.length(); index++) {
                        JSONObject jsonName = (JSONObject) objNames.get(index);
                        System.out.println("The display name:"+jsonName.getString((String) objNames.get(index)));
                        System.out.println("The Image:"+jsonName.getString("image"));
                        System.out.println("The URL:"+jsonName.getString("url"));

             }
             }


         }catch(Exception e)
         {
             e.printStackTrace();
         }

But it returns an error as:

05-04 01:59:54.737: W/System.err(3850): org.json.JSONException: Value tl at 0 of type java.lang.String cannot be converted to JSONObject
05-04 01:59:54.737: W/System.err(3850):     at org.json.JSON.typeMismatch(JSON.java:96)
05-04 01:59:54.737: W/System.err(3850):     at org.json.JSONArray.getJSONObject(JSONArray.java:484)
05-04 01:59:54.747: W/System.err(3850):     at com.TCC.android.parse.JsonParse.parseBrands(JsonParse.java:30)
05-04 01:59:54.747: W/System.err(3850):     at com.TCC.android.ResearchList$2$2.run(ResearchList.java:167)

I am trying to resolve this problem but everytime failed, I can do this by everytime get the Json object and parse its values but its too lengthy task when the Objects increased to more than 100. I need a systematic and efficient way to do that. Please suggest me any solution regarding that.

  • 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-03T09:39:03+00:00Added an answer on June 3, 2026 at 9:39 am

    Your problem is that you are getting an array of strings as your names, but then trying to pull JSONObjects out of that same array. That array only contains strings, as evidenced by your stack trace. You need to iterate through your list of names and for each name you get out of the objNames array, do a jsonObj.get(name) and cast THAT to a JSONObject.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to display place details from this json: I have problem with parse
I have a problem with this code right here: - (void)fetchedData:(NSData *)responseData { //parse
I have a probably quite simple to solve problem. I'm trying to parse this
I have a problem with parsing a JSON result. This is what I get
i need to parse the Apple JSON but i have a little problem. I'm
I have a problem which requires me to parse several log files from a
I have a problem with using the SAX parser to parse a XML file.
I have a problem with sax parser and encoded text. I try to parse
I have a problem with parseInt() , it throws the error: unable to parse
I have one interesting problem. I must parse mail body (regular expression), get some

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.