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.

Title: Normalization of 'JSON' Strings
Version: 1.0.0
Description: Provides a function allowing to normalize a 'JSON' string, for example by adding double quotes around the keys when they are missing. Also provides 'RStudio' addins for the same purpose.
License: GPL-3
URL: https://github.com/stla/jsonNormalize
BugReports: https://github.com/stla/jsonNormalize/issues
Imports: rstudioapi, V8
Encoding: UTF-8
RoxygenNote: 7.2.3
NeedsCompilation: no
Packaged: 2023-05-24 11:20:44 UTC; stla
Author: Stéphane Laurent [aut, cre], David Kaye [aut, cph] (author of the JavaScript code)
Maintainer: Stéphane Laurent <laurent_step@outlook.fr>
Repository: CRAN
Date/Publication: 2023-05-25 20:00:05 UTC

Normalize a JSON string

Description

Attempts to normalize or fix a JSON string. Trailing commas are removed, and all keys of the normalized JSON string are double-quoted.

Usage

jsonNormalize(jstring, prettify = FALSE, to = NULL)

Arguments

jstring

a character string, the JSON string to be normalized, or the path to a JSON file

prettify

Boolean, whether to prettify the normalized JSON string

to

NULL to return the normalized JSON string, otherwise the path to a JSON file to which the normalized JSON string will be written

Value

The normalized JSON string.

Note

The special JavaScript values undefined and NaN are not allowed in JSON strings. If one of them occurs in the input string, it is replaced by the empty string.

Examples

library(jsonNormalize)
# the keys of the following JSON string are not quoted
jstring <- "[{area:30,ind:[5,3.7], cluster:true,},{ind:[],cluster:false},]"
cat(jsonNormalize(jstring, prettify = TRUE))

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.