title: I am exposing an object using <script type="text/json" id="myJSON"> on the webpage. Whats the best way to access it on the JavaScript?
body: <p>In my project we are write our code in AMD modules. My idea is to create an amd module, where I'll access the script tag using jquery id selector and then parse it to JSON.
  For example:</p>
  
  <pre><code>&lt;script type="text/json" id="myJSON"&gt;
  {key1:"val1", key2:"val2", key3:"val3", key4:"val4"}
  &lt;/script&gt;
  
  
  define(function() {
     var data = $('#myJSON').text();
     var json = JSON.parse(data);
  
     return json;
  });
  </code></pre>
  
  <p>is this a good approach, or it there any better approach where we can write something like get(key) function to access the value of any key. </p>
  
  <p>NOTE: Exposed object might be a nested object in future.</p>