jsonPretty: Pretty JSON string

Description Usage Arguments Value Examples

Description

Returns a JSON string in pretty format.

Usage

1
2
jsonPretty(json, indent = "indent2", numformat = "generic",
  toJSON = FALSE)

Arguments

json

JSON string

indent

indentation per level of nesting; choices are "indent0" (remove all white spaces), "indent1", "indent2", "indent3", "indent3", and "tab" (tabulation)

numformat

number format; choices are:

  • "generic": integer literals for integers (1, 2, ...), simple decimals for fractional values between 0.1 and 9999999, and scientific notation otherwise

  • "decimal": standard decimal notation

  • "scientific": scientific notation

toJSON

logical, whether to apply toJSON to the input

Value

A JSON string.

Examples

1
2
3
4
json <- "{\"a\": {\"b\": 8, \"c\": [1,2]}, \"b\": [10.14, 11.618]}"
jsonPretty(json) %>% cat
jsonPretty(json, indent="indent0") %>% cat
jsonPretty(json, indent="tab", numformat="scientific") %>% cat

stla/jsonAccess documentation built on May 30, 2019, 5:47 p.m.