Normalization of 'JSON' Strings

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.


jsonNormalize

R-CMD-check

Normalize JSON strings.


library(jsonNormalize)

badJstring <- "
[
  { 01: false, 999: true, },
  {
    area: 30,
    thirty: '30',
    ind: [5, 4.1,   3.7 , 1e3,],
    'cluster'    : true  ,
    \"999\": false,
    city: 'London'
  },
  [ null, undefined,   NaN],
  {
    'null': null,
    'undefined': undefined,
    'NaN': NaN
  }
]"
goodJstring <- jsonNormalize(badJstring, prettify = TRUE)
cat(goodJstring)
[
  {
    "999": true,
    "01": false
  },
  {
    "999": false,
    "area": 30,
    "thirty": "30",
    "ind": [
      5,
      4.1,
      3.7,
      1000
    ],
    "cluster": true,
    "city": "London"
  },
  [
    null,
    "",
    ""
  ],
  {
    "null": null,
    "undefined": "",
    "NaN": ""
  }
]

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("jsonNormalize")

1.0.0 by Stéphane Laurent, 3 years ago


https://github.com/stla/jsonNormalize


Report a bug at https://github.com/stla/jsonNormalize/issues


Browse source code at https://github.com/cran/jsonNormalize


Authors: Stéphane Laurent [aut, cre] , David Kaye [aut, cph] (author of the JavaScript code)


Documentation:   PDF Manual  


GPL-3 license


Imports rstudioapi, V8


See at CRAN