Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

read_json

Read/write JSON


Description

These functions are similar to toJSON and fromJSON except they explicitly distinguish between path and literal input, and do not simplify by default.

Usage

read_json(path, simplifyVector = FALSE, ...)

parse_json(json, simplifyVector = FALSE, ...)

write_json(x, path, ...)

Arguments

path

file on disk

simplifyVector

simplifies nested lists into vectors and data frames. See fromJSON.

...

additional conversion arguments, see also toJSON or fromJSON

json

string with literal json or connection object to read from

x

an object to be serialized to JSON

See Also

Examples

tmp <- tempfile()
write_json(iris, tmp)

# Nested lists
read_json(tmp)

# A data frame
read_json(tmp, simplifyVector = TRUE)

jsonlite

A Simple and Robust JSON Parser and Generator for R

v1.7.2
MIT + file LICENSE
Authors
Jeroen Ooms [aut, cre] (<https://orcid.org/0000-0002-4035-0289>), Duncan Temple Lang [ctb], Lloyd Hilaiel [cph] (author of bundled libyajl)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.