Indent JSON with JavaScript

added by JavaScript Kicks
3/27/2015 2:22:54 PM


Working with XML and JavaScript is a nightmare, which is why JSON has become gold in the development community. Hell, I even wrote a function to turn XML to JSON with JavaScript. If you want to turn an existing object into well formatted JSON, you can you JSON.stringify(obj), but you already know that. What you may not know is that you can do pretty formatting when generating JSON from objects!