Sorry for late reply. Here is a slightly improved version of the patch with the new `h_atoi` function, I hope this implementation will be more appropriate.
>>> I think it would be better if the ident printing didn't put the start of array ([) and start of dictionary ({) on separate line Did you mean this?
[ { "a": 1, "b": 2 } ]
I tried to verify this in several ways (http://jsonprettyprint.com/, "JSON.stringify", "json.too" from python), and I always get this result (new line after ([) and ({) ).
No, I mean new lines before the ([) and ({) - try pretty printing something like '{"a":["b", "c"], "d": {"e":"f"}}' using that tool you pasted and see what your patch outputs to see what I mean.
Please try this patch and see if it's doing what you want.
Yes, this produces output that looks like what javascript/python produce.
(the other stuff I commented about, mainly the h_atoi is still unfixed though)