prettify: Prettify or minify a JSON string

View source: R/prettify.R

prettify, minifyR Documentation

Prettify or minify a JSON string

Description

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

Usage

prettify(txt, indent = 4)

minify(txt)

Arguments

txt

JSON string

indent

number of spaces to indent

Examples

myjson <- toJSON(cars)
cat(myjson)
prettify(myjson)
minify(myjson)

jsonlite documentation built on July 9, 2023, 6:11 p.m.