KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Possible Duplicate: How can I beautify JSON programmatically? I know how to generate JSON from an object using JSON.stringify, or in my case the handy jQuery JSON from Google Code . Now this works fine, but the output is hard to read for humans. Is there an easy way, function, or whatever to output a neatly formatted JSON file? This is what I mean: JSON.stringify({a:1,b:2,c:{d:1,e:[1,2]}}); gives... "{"a":1,"b":2,"c":{"d":1,"e":[1,2]}}" I'd like something like this instead: { "a":1, "b":2, "c":{ "d":1, "e":[1,2] } } E.g., with newlines and tabs added. It's much easier to read for larger documents. I'd like to do this ideally without adding any huge libraries, for example, not Prototype , YUI , or whatever.
Tags (comma-separated)
Save Edits
Cancel