-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
45 lines (37 loc) · 861 Bytes
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
---
title: "jsonNormalize"
output: github_document
---
<!-- badges: start -->
[![R-CMD-check](https://github.com/stla/jsonNormalize/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/stla/jsonNormalize/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
Normalize JSON strings.
___
```{r jsonHook, include=FALSE}
knitr::knit_hooks$set(output = function(x, options) {
paste0(c("```json", x, "```"), collapse = "\n")
})
```
```{r, comment=""}
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)
```