title: Pretty printing a JSON string in HTML
body: <p>I have a string like <code>{ "a": "1", "b": "2", "c": "3", "asefw": "Chintan" }</code> and I need to properly indent it to print it out in html.</p>
  
  <p>Right now, I'm using a combination of google-code-prettify (for syntax highlighting), and ruby's JSON object to print it out, but the indentation is slightly off:
  <img src="https://i.stack.imgur.com/sGPv6.png" alt="enter image description here"></p>
  
  <p>Here's the relevant code from my Rails view:</p>
  
  <pre><code>.container
    .row.demo-samples
      .span9{:style =&gt; "\n-moz-border-radius: 8px 8px 6px 6px;\nborder-radius: 8px 8px 6px 6px;"}
        -@content.each do |content|
          %pre
            %code.prettyprint
              =JSON.pretty_generate(JSON[content.content])
  </code></pre>
  
  <p>It looks like everything but the first row is indented too much. Any idea how to fix this?</p>