title: How do I properly structure nested JSON values?
body: <p>I have a collection of JSON values that has 3 levels:</p>
  
  <p>cluster > segment > node</p>
  
  <p>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. </p>
  
  <p>Each node contains an id and a reference to its segment id and cluster id. I have written up a test object like this:</p>
  
  <pre><code> 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
                       }
  ];
  </code></pre>
  
  <p>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?</p>
  
  <p>EDIT:</p>
  
  <p>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.</p>