tidyjson (version 0.2.2)

json_types: Add a column that tells the 'type' of the data in the root of the JSON

Description

The function json_types() inspects the JSON associated with each row of the tbl_json data.frame, and adds a new column ("type" by default) that identifies the type according to the JSON standard at http://json.org/.

Usage

json_types(x, column.name = "type")

Arguments

x
a tbl_json object
column.name
the name to specify for the type column

Value

a tbl_json object with column.name column that tells the type

Details

This is particularly useful for inspecting your JSON data types, and can added after gather_array() (or gather_keys()) to inspect the types of the elements (or values) in arrays (or objects).

Examples

Run this code
library(magrittr)  # for %>%
c('{"a": 1}', '[1, 2]', '"a"', '1', 'true', 'null') %>% json_types

Run the code above in your browser using DataLab