prettify function

Prettify or minify a JSON string

Prettify or minify a JSON string

Prettify adds indentation to a JSON string; minify removes all indentation/whitespace.

prettify(txt, indent = 4) minify(txt)

Arguments

  • txt: JSON string
  • indent: number of spaces to indent. Use a negative number for tabs instead of spaces.

Examples

myjson <- toJSON(cars) cat(myjson) prettify(myjson) minify(myjson)
  • Maintainer: Jeroen Ooms
  • License: MIT + file LICENSE
  • Last published: 2025-03-27