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

The Archive Base Latest Questions

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

It looks like good JSON objects typically have a name-value pair, with value being

  • 0

It looks like good JSON objects typically have a name-value pair, with value being JSON array if it has multiple items. That’s easier to parse.

But I come across an annoying case, I’m unsure how to parse. While my question is specific to .NET and I’m using JSON.NET library on CodePlex (primarily LINQ to JSON approach, but could take other approaches), also wonder how this is handled in other language platforms as well.

The annoying case is JSON without arrays and name-value pairs only at the lowest level children, JSON object whose nodes contain more objects until the lowest level where we get properties as name-value pairs. And I want to extract a list of the intermediate nodes and I don’t know their node names beforehand while doing query (they’re dynamic). How do you query for them or iterate through them. Here’s an example below – I want all the names of the nodes that are children of “response”. The parent name of the albumData properties that is, as in “Twenty5MBPhotos” and “TestPhotos”.

{"status":200,"message":"OK","response":{"Twenty5MBPhotos":{"__albumData":{"id":"67b0de21d48290741598"}},"FiveMBPhotos":{"__albumData":{"id":"67b0de21d4a72ac5b401"}},"TestPhotos":{"__albumData":{"id":"67b0de21d64693a7f49f"}},"Sample album":{"__albumData":{"id":"67b0de21d67c4a99f4c3"}},"Empty":{"__albumData":{"id":"67b0de21d5fc3f2e05ac"}},"me":{"__albumData":{"id":"67b0de21d5bd2d1ea4f9"}},"satx":{"__albumData":{"id":"67b0de21d5b2f929c473"}},"designs":{"__albumData":{"id":"67b0de21d5a29b9f45c0"}},"views":{"__albumData":{"id":"67b0de21d5958c3b652e"}},"Puppy":{"__albumData":{"id":"67b0de21d540884dc413"}},"QaTest":{"__albumData":{"id":"67b0de21d6d96c35d419"}},"random":{"__albumData":{"id":"67b0de21d6b89b9ab401"}}}}

frankly, the JSON format could have been easier with result being an array with properties album name, and album ID instead of current format, but I didn’t define this.

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

    You can get all the names like this:

        JObject obj = JObject.Parse(json);
        var children= obj["response"];
    
        foreach (var item in children)
        {
            string val = ((JProperty)item).Name;   
        }
    

    Just need to cast the JToken as a JProperty to get the name value.

    Update:

    Or with some linq

    var theNamesAndIds = children.ToDictionary(m => ((JProperty)m).Name,
                                               m => m.First()["__albumData"]["id"]);
    
    foreach (var item in theNamesAndIds)
    {
        //item has your key(name) and value(Id)
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a JSON object that looks like this. [ { id : 23,
I have a MongoDB Collection called Questions which holds JSON Objects that look like
I've been looking into OSGi recently and think it looks like a really good
I might be one anal programmer, but I like code that looks good from
lets say I have a String like this [{ name : Ronald , firstname
I am trying to deserialize a JSON string that looks like so: {'type':'clientlist','client_list':[]} I
I have done some searching around, and from what it looks like so far,
Good day, I've got WebMethod that looks a bit like this... [WebMethod] public static
I have a directory with files that look like this: 001_something.php 002_something_else.php 004_xyz.php 005_do_good_to_others.php
I would like to look at some examples of some good form layouts (web-based)

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.