In some cases, e.g. map storage, formatted JSON has so much whitespace that it becomes 10 times bigger than the compact version. The above link is about 360kb, and over 2MB with whitespace, and didn't save until i trimmed it a bit.
While we save it as compact, it gets transmitted as pretty-printed when editing it in Commons. On the other hand, editing it by hand requires JSON to be semi-pretty printed. For example, array of array of array of a numbers might make sense to keep on the same line.
There are many libraries available, such as this, but they all seem to be in PHP. I think this is actually fine, as it gives us an opportunity to move towards compact-only server-side handling of the JSON, and we can expand it client-side on the fly, which is the first step towards a rich client-side editor.