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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:16:52+00:00 2026-05-25T17:16:52+00:00

I want to parse some JSON data. I’m using James Newton-King’s JSON.NET library .

  • 0

I want to parse some JSON data. I’m using James Newton-King’s JSON.NET library.

I parse the JSON string into a JObject. Here is the JSON I’m parsing:

"root": [
{
  "date": 1325400000000,
  "id": 12313131,
  "loc": "en_us",
  "name": "New York, NY",
  "products": [
    {
      "@type": "asdf",
      "city": "New York - Penn Station, NY (NYP)",
      "code": "USA",
    }
  ],
  "summary": {
    "alert": [],
    "end": 1325577000000,
    "start": 1325400000000
  }
}
]
}

As you can see it’s pretty complex. The “root” was necessary because otherwhise the data could not be parsed into a JObject instance.

JObject o = JObject.Parse(jsonString);

The JSON data is quite large. There are multiple items in it with different IDs. I want to find an item with a specifid ID.

The problem is, when I try to foreach through the data it has only one element.

KEY: root
VALUE: the other stuff.

So how do I get to the other stuff and cycle through what’s inside?

  • 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-25T17:16:52+00:00Added an answer on May 25, 2026 at 5:16 pm

    Nevermind..

    I just solved it.

    I removed the trailing [ and the end ].

    So it is now a Valid Json object and Key Value foreach is working like a charm..

                foreach (KeyValuePair<String, JToken> d in o)
                {
                    Console.WriteLine(String.Format("Key: {0}; Value: {1}", d.Key, d.Value));
                }
    

    Hurray!

    Turned out this is only a partial solution. Because now the others are not formatted only the first segment is. The others somehow disappear… :S Damn this…

    Even better solution… I was a complete idiot…

    Leave everything in place and simply use JArray ja = JArray.Parse(stringOfJson);

    This will give you an array full with all the data free to cycle through… Awesome. 🙂

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

Sidebar

Related Questions

I'm trying to parse some JSON using the JSon.Net library. The documentation seems a
I want to create a data structure that will be parse as a JSON
I want to parse this content using Javascript. The data looks like this: {ss:[[Thu,7:00,Final,,BAL,19,ATL,20,,,56808,,PRE4,2015],[Thu,7:00,Final,,NO,10,GB,38,,,56809,,PRE4,2015]]}
I'm trying to parse some JSON data from the Google AJAX Search API. I
I am using titanium for developing Android application. I want to delete some data
I want to parse some HTML in order to find the values of some
Let's say this page www.example.com/mypage returns some html that I want to parse in
I want to parse a filter string similar to the following: ((Field1 = 'red')
I want to parse the input string and extract the values from it. My
I have been using jquery ajax method to get the json data. I have

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.