Add optional 'indent' parameter to json output

Indent controls how many spaces are used to indent each
json block. If indent is > 0, newlines and indents are added.
If indent == 0, the json document is output on a single line