title: Using PHP Class Structures to Generate JSON Documents
body: <p>Is anyone able to give me an insight how to use PHP classes to generate a JSON structure based on the following template</p>
  
  <pre><code>{
  "Summary": "A long route",
  published": true,
  "Route 1": [
      {
          "Lat": 23.4,
          "Long": 34.5
      },
      {
          "Lat": 27.4,
          "Long": 384.5
      } ...
  ]
  "Route 2": [
      {
          "Lat": 25.4,
          "Long": 34.5
      },
      {
          "Lat": 29.4,
          "Long": 384.5
      } ...
  ]......
  </code></pre>
  
  <p>}</p>
  
  <p>I am able to generate a constructor function that allows me to instantiate the classes  using the method of <code>$routes['Route 1'] = new Route[32.4,34.5]</code> but I am not sure how to generate additional waypoints, or Lat and Long elements for a say <code>Route 1</code>, without re-instantiating the Route class.  </p>