fromJSON {jsonlite} R Documentation

Convert R objects to/from JSON

Description


These functions are used to convert between JSON data
and R objects. The toJSON and fromJSON functions use a
class based mapping, which follows conventions outlined
in this paper:https://arxiv.org/abs/1403.2805(also
available as vignette).

Usage

fromJSON(txt,
    simplifyVector = TRUE,
    simplifyDataFrame = TRUE,
    simplifyMatrix = TRUE,
    flatten = FALSE,
    ... = NULL);

Arguments

txt

a JSON string, URL or file. [as string]

simplifyVector

coerce JSON arrays containing only primitives into an atomic vector. [as boolean]

simplifyDataFrame

coerce JSON arrays containing only records (JSON objects) into a data frame. [as boolean]

simplifyMatrix

coerce JSON arrays containing vectors of equal mode and dimension into matrix or array. [as boolean]

flatten

automatically flatten nested data frames into a single non-nested data frame. [as boolean]

args

arguments passed on to class specific print methods. [as list]

env

[as Environment]

Details

The toJSON and fromJSON functions are drop-in replacements for the identically named functions in packages rjson and RJSONIO. Our implementation uses an alternative, somewhat more consistent mapping between R objects and JSON strings. The serializeJSON and unserializeJSON functions in this package use an alternative system to convert between R objects and JSON, which supports more classes but is much more verbose. A JSON string is always unicode, using UTF-8 by default, hence there is usually no need to escape any characters. However, the JSON format does support escaping of unicode characters, which are encoded using a backslash followed by a lower case "u" and 4 hex characters, for example: "Z\u00FCrich". The fromJSON function will parse such escape sequences but it is usually preferable to encode unicode characters in JSON using native UTF-8 rather than escape sequences.

Authors

SMRUCC genomics

Value

this function returns data object of type any kind.

clr value class

Examples


[Package jsonlite version 6.0.0.3654 Index]