The jsonlite Package: A Practical and Consistent Mapping Between JSON Data and R Objects

نویسنده

  • Jeroen Ooms
چکیده

A naive realization of JSON data in R maps JSON arrays to an unnamed list, and JSON objects to a named list. However, in practice a list is an awkward, inefficient type to store and manipulate data. Most statistical applications work with (homogeneous) vectors, matrices or data frames. Therefore JSON packages in R typically define certain special cases of JSON structures which map to simpler R types. Currently there exist no formal guidelines, or even consensus between implementations on how R data should be represented in JSON. Furthermore, upon closer inspection, even the most basic data structures in R actually do not perfectly map to their JSON counterparts and leave some ambiguity for edge cases. These problems have resulted in different behavior between implementations and can lead to unexpected output. This paper explicitly describes a mapping between R classes and JSON data, highlights potential problems, and proposes conventions that generalize the mapping to cover all common structures. We emphasize the importance of type consistency when using JSON to exchange dynamic data, and illustrate using examples and anecdotes. The jsonlite R package is used throughout the paper as a reference implementation.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

A Calculus with Partially Dynamic Records for Typeful Manipulation of JSON Objects

This paper investigates language constructs for high-level and type-safe manipulation of JSON objects in a typed functional language. A major obstacle in representing JSON in a static type system is their heterogeneous nature: in most practical JSON APIs, a JSON array is a heterogeneous list consisting of, for example, objects having common fields and possibly some optional fields. This paper p...

متن کامل

3D Modelling of Under Ground Burried Objects Based on Ground Penetration Radar

There is a growing demand for mapping and 3D modelling of buried objects such as pipelines, agricultural hetitage, landmines and other buried objects. Usually, large scale and high resolution maps from these objects are needed. Manually map generation and modeling of these objects are cost and time consuming and is dependent on lots of resources. Therefore, automating the subsurface mapping and...

متن کامل

Fuzzy decision making in testing hypotheses: An introduction to the packages ``FPV" and ``Fuzzy.p.value" with practical examples

This paper reviews and compares two R packages ``FPV" and ``Fuzzy.p.value".These packages are designed for testing hypotheses in a fuzzy environment using a fuzzy $p$-value based approach.In fact, the packages ``FPV" and ``Fuzzy.p.value" propose some useful functions for testing hypotheses when the data / hypotheses are fuzzy rather than crisp.The proposed methods and function...

متن کامل

rnrfa: An R package to Retrieve, Filter and Visualize Data from the UK National River Flow Archive

The UK National River Flow Archive (NRFA) stores several types of hydrological data and metadata: daily river flow and catchment rainfall time series, gauging station and catchment information. Data are served through the NRFA web services via experimental RESTful APIs. Obtaining NRFA data can be unwieldy due to complexities in handling HTTP GET requests and parsing responses in JSON and XML fo...

متن کامل

RProtoBuf: Efficient Cross-Language Data Serialization in R

Modern data collection and analysis pipelines often involve a sophisticated mix of applications written in general purpose and specialized programming languages. Many formats commonly used to import and export data between different programs or systems, such as CSV or JSON, are verbose, inefficient, not type-safe, or tied to a specific programming language. Protocol Buffers are a popular method...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:
  • CoRR

دوره abs/1403.2805  شماره 

صفحات  -

تاریخ انتشار 2014