The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
fromJSON() parses JSON arrays, objects, strings,
numbers, booleans, and nulls. The return type depends on the JSON shape
and the simplification settings.
fromJSON("[1, 3, 10, 19]")
#> [1] 1 3 10 19
fromJSON('{"a": 1, "b": true, "c": "value"}')
#> $a
#> [1] 1
#>
#> $b
#> [1] TRUE
#>
#> $c
#> [1] "value"Use I() when passing JSON text that should be treated
explicitly as content.
File paths are read from disk when asText = FALSE, which
is the default for plain character strings that do not look like JSON
content.
Connections are useful when JSON content is already available through an R connection object.
By default, JSON null maps to NULL in list
output. Use nullValue to preserve positions in simplified
vectors.
Strict simplification keeps incompatible values as
lists. Less strict simplification can coerce mixed compatible values
into an atomic vector.
fromJSON('[1, "2.3", "abc"]', simplify = Strict)
#> [[1]]
#> [1] 1
#>
#> [[2]]
#> [1] "2.3"
#>
#> [[3]]
#> [1] "abc"
fromJSON('[1, "2.3", "abc"]', simplify = TRUE)
#> [1] "1.000000" "2.3" "abc"
fromJSON('{"a": 1, "b": 2}', simplify = Strict)
#> a b
#> 1 2
fromJSON('{"a": 1, "b": 2}', simplify = FALSE)
#> $a
#> [1] 1
#>
#> $b
#> [1] 2The package includes JSON fixtures that are useful for examples and local checks.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.