descj: JSON Description

Description Usage Arguments Details Value See Also Examples

View source: R/desc.r

Description

Provide descriptive information about the JSON list, such as the key frequency, the nesting information and the value distribution.

Usage

1
descj(dat, sep = "@")

Arguments

dat

list. Loaded result from a JSON file.

sep

character. A character/string passed to flattenj. Defaults to @ to avoid the occasional overriding. Not recommended to use some risky characters like . and \.

Details

The result contains three parts:

Note that the mathematical logic of frequency is based on the flattening work, which means the occurrence of one key will be considered as repeated if it has multiple downstream keys. For example, list(list(x = list(m = 1, n = 2), y = 2)), and the frequency of x will be 2, because it has two nesting keys. It is recommended to interpret the upstream and downstream information in a relative way rather than an absolute way. Returning the absolute frequency is to preserve the raw information. Hence, it is easy to know that x will equally branches to m and n.

Value

list. The descriptive result.

See Also

flattenj.

Examples

1
2
3
4
5
6
library(mojson)
j <- list(a = list(x = 1, y = 2),
          b = c(3, 4, list(z = 5, s = 6, t = list(m = 7, n = 8))))
j_multi <- list(j, j, j)
desc <- descj(j_multi)
desc$keys_summary

mojson documentation built on Feb. 11, 2021, 5:07 p.m.