I have a string like { "a": "1", "b": "2", "c": "3", "asefw": "Chintan" } and I need to properly indent it to print it out in html.
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:

Here's the relevant code from my Rails view:
.container
.row.demo-samples
.span9{:style => "\n-moz-border-radius: 8px 8px 6px 6px;\nborder-radius: 8px 8px 6px 6px;"}
[email protected] do |content|
%pre
%code.prettyprint
=JSON.pretty_generate(JSON[content.content])
It looks like everything but the first row is indented too much. Any idea how to fix this?
This FAQ entry might help....
http://haml.info/docs/yardoc/file.FAQ.html#q-preserve
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With