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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:56:30+00:00 2026-05-20T10:56:30+00:00

I have a collection of JSON values that has 3 levels: cluster > segment

  • 0

I have a collection of JSON values that has 3 levels:

cluster > segment > node

Where each cluster is made of segments and each segment is made up of nodes. I am trying to figure out how to represent this as a JSON object and I am unsure how to create the structure.

Each node contains an id and a reference to its segment id and cluster id. I have written up a test object like this:

 var customers = [
                     {
                    "cluster" : 
                         {"flights":4, "profit":5245, "clv":2364,
                    "segment" :
                        { "flights":2, "profit":2150, "clv":1564,
                            "node" :
                                    { 'xpos': 1, 'ypos': 2 }// closes node
                        }// closes segment 
                         }//closes cluster
                     },
{
                    "cluster" : 
                         {"flights":4, "profit":5245, "clv":2364,
                    "segment" :
                        { "flights":2, "profit":2150, "clv":1564,
                            "node" :
                                    { 'xpos': 1, 'ypos': 2 }// closes node
                        }// closes segment 
                         }//closes cluster
                     }
];

The part that feels a bit flaky is the way segment and node are nested. I am not getting any errors but is this the best way to represent this data?

EDIT:

Thanks for the answers, it definitely pointed me in the right direction as far as tools to use (jsonlint) and get a better understanding of structuring data in json. They’re all correct answers which shows me that it was a pretty basic question. Thanks again.

  • 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-20T10:56:31+00:00Added an answer on May 20, 2026 at 10:56 am

    the nature of json you have is perfectly valid (the idea of an object nested in an object) if not syntactically correct (didn’t verify that all your commas were in the right place).

    however, you dont have what you said you wanted, which is a collection of segments in a cluster, and a collection of nodes in a segment.

    change it to be

    [{
      "cluster": {..,
         "segments": [{    <--- note the array -- you now have a collection
             "name": 'segment1', <- optional, just here to show multiple segments
             "nodes": [{....}] <-- same here
         }, 
         {
             "name": 'segment2',
             "nodes": [{....}]
         }]
      }
    }]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list that I need to fill using a JSON collection of
I have a collection of classes that inherit from an abstract class I created.
I have a collection of non-overlapping rectangles that cover an enclosing rectangle. What is
I have a collection of classes that I want to serialize out to an
I have a collection of elements that I need to operate over, calling member
I have a collection of unmanaged dlls with a C# wrapper around them that
On JSON.org the essential data structures that JSON represents are given as A collection
I have a ListView that contains a large collection of rows with textboxes that
I have a collection of divs that contain either images or checkboxes. My end
I have a JSON object collection: var Gallery = [ { Order: 1, Page:

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.