title: Why declare variable with json in js file instead of reading json?
body: <p>Recently I've been working with <code>leaflets</code>, and I'm currently looking at several plugins.</p>
  
  <p>Several of the plugins I've seen (including <a href="https://github.com/Leaflet/Leaflet.markercluster" rel="nofollow noreferrer">Leaflet.markercluster</a>) use <code>json</code> to plot points, but instead of using the actual stream, or a <code>json</code> file, the programmer includes a javascript <code>.js</code> file where a variable is set with the json stream. So the <code>js</code> file with the json data looks like this:</p>
  
  <pre><code>var data = [
      {"loc":[41.575330,13.102411], "title":"aquamarine"},
      {"loc":[41.575730,13.002411], "title":"black"},
      {"loc":[41.807149,13.162994], "title":"blue"},
      {"loc":[41.507149,13.172994], "title":"chocolate"}
  ]
  </code></pre>
  
  <p>I've been working with other type of javascript charts, and most of them read and process a json stream.</p>
  
  <p>It seems these plugins will not work if I create a service that returns json.</p>
  
  <p>Why not use json instead of including a js file that sets a variable with a json stream?</p>
  
  <p>I'm not a javascript expert, but I find it easier to generate json than a javascript file with json in it.</p>