powered by
Prettify adds indentation to a JSON string; minify removes all indentation/whitespace.
prettify(txt, indent = 4)minify(txt)
minify(txt)
JSON string
number of spaces to indent
myjson <- toJSON(cars) cat(myjson) prettify(myjson) minify(myjson)
Run the code above in your browser using DataLab