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 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
  • 1 View
  • 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 json object collection of geo locations that I build in the
I have a DAG in a JSON format, where each node is an entry:
I have created a web service that is basically a json set of values
I have the following Json collection and I need to represent it as a
I have this json which populates my collection ( TableListCollection ) of models (
I have a simple json string which contains a collection of objects http://sandapps.com/InAppAds/ads.json.txt When
I have Collection List<Car> . How to compare each item from this collection with
I'm planning to have collection of items stored in a TCollection. Each item will
for example I have collection foo of documents like that: {tag_cloud:[{value:games, count:10}, {value:girls, count:500}]}
So I have an app that downloads and parses a JSON feed with 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.