write_json: Function to write an R object to a JSON file.

View source: R/write_json.R

write_jsonR Documentation

Function to write an R object to a JSON file.

Description

write_json uses jsonlite as the data frame to JSON parser.

Usage

write_json(x, file, pretty = TRUE, na = FALSE, auto_unbox = FALSE)

Arguments

x

R object to be written as a JSON file.

file

JSON file name.

pretty

Should the JSON output be formatted for readability? Default is TRUE.

na

Should NA values be kept in the JSON file? Default is FALSE. If na is TRUE then NAs will transformed to JSON's null value.

auto_unbox

Should vectors with the length of 1 be represented as atomic, single element arrays? Default is FALSE.

Value

Invisible x.

Author(s)

Stuart K. Grange.

Examples

## Not run: 

# Export a data frame
write_json(data_car_identifiers, "car_identifiers.json")


## End(Not run)


skgrange/threadr documentation built on May 11, 2024, 12:16 p.m.