title: How to display raw JSON data on a HTML page
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4810841/json-pretty-print-using-javascript">JSON pretty print using JavaScript</a>  </p>
  </blockquote>
  
  
  
  <p>I'd like to display my raw JSON data on a HTML page just as JSONview does. For example, my raw json data is:</p>
  
  <pre><code>  {
     "hey":"guy",
     "anumber":243,
     "anobject":{
        "whoa":"nuts",
        "anarray":[
           1,
           2,
           "thr&lt;h1&gt;ee"
        ],
        "more":"stuff"
     },
     "awesome":true,
     "bogus":false,
     "meaning":null,
     "japanese":"明日がある。",
     "link":"http://jsonview.com",
     "notLink":"http://jsonview.com is great"
  }
  </code></pre>
  
  <p>It comes from <a href="http://jsonview.com/" rel="noreferrer">http://jsonview.com/</a>, and what I want to achieve is like  <a href="http://jsonview.com/example.json" rel="noreferrer">http://jsonview.com/example.json</a> if you use Chrome and have installed the JSONView plugin.</p>
  
  <p>I've tried but failed to understand how it works. I'd like to use a JS script (CSS to highlight) to custom format my raw JSON data which is retrieved by ajax and finally put it on a HTML page in any position like into a div element. Are there any existing JS libraries that can achieve this? Or how to do it? </p>