Prettify or minify a JSON string
Prettify adds indentation to a JSON string; minify removes all indentation/whitespace.
prettify(txt, indent = 4) minify(txt)
txt
: JSON stringindent
: number of spaces to indent. Use a negative number for tabs instead of spaces.myjson <- toJSON(cars) cat(myjson) prettify(myjson) minify(myjson)