Learn R Programming

mojson (version 0.1)

loadj: JSON Load

Description

Load a JSON file into an R list

Usage

loadj(file, encoding = "UTF-8")

Arguments

file

character. A JSON file connection.

encoding

character. Encoding method to use. Defaults to UTF-8.

Value

list. The loading result.

Details

This function provides a simple interface to load a JSON file, meanwhile prints some loading information.

  • num_of_loaded_obj tells the length of the JSON object.

  • duration_seconds tells the loading duration.

  • speed_objs_sec tells the loading speed in objects per second.

  • obj_len_summary gives the length summary of each JSON object.

Examples

Run this code
# NOT RUN {
library(mojson)
j <- list(a = list(1, 2), b = 3)
tf <- tempfile()
writeLines(RJSONIO::toJSON(j), tf)
loadj(tf)
# }

Run the code above in your browser using DataLab