License: Creative Commons Attribution 3.0 Unported license (CC BY 3.0)
When quoting this document, please refer to the following
DOI: 10.4230/LIPIcs.ECOOP.2016.18
URN: urn:nbn:de:0030-drops-61128
Go to the corresponding LIPIcs Volume Portal

Ohori, Atsushi ; Ueno, Katsuhiro ; Sasaki, Tomohiro ; Kikuchi, Daisuke

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

LIPIcs-ECOOP-2016-18.pdf (0.5 MB)


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 presents a typed calculus that reconciles static typing constraints and heterogeneous JSON arrays based on the idea of partially dynamic records originally proposed and sketched by Buneman and Ohori for complex database object manipulation. Partially dynamic records are dynamically typed records, but some parts of their structures are statically known. This feature enables us to represent JSON objects as typed data structures. The proposed calculus smoothly extends with ML-style pattern matching and record polymorphism. These results yield a typed functional language where the programmer can directly import JSON data as terms having static types, and can manipulate them with the full
benefits of static polymorphic type-checking. The proposed calculus
has been embodied in SML#, an extension of Standard ML with record
polymorphism and other practically useful features. This paper also
reports on the details of the implementation and demonstrates its
feasibility through examples using actual Web APIs. The SML# version 3.1.0 compiler includes JSON support presented in this paper, and is available from Tohoku University as open-source software under a BSD-style license.

BibTeX - Entry

  author =	{Atsushi Ohori and Katsuhiro Ueno and Tomohiro Sasaki and Daisuke Kikuchi},
  title =	{{A Calculus with Partially Dynamic Records for Typeful Manipulation of JSON Objects}},
  booktitle =	{30th European Conference on Object-Oriented Programming (ECOOP 2016)},
  pages =	{18:1--18:25},
  series =	{Leibniz International Proceedings in Informatics (LIPIcs)},
  ISBN =	{978-3-95977-014-9},
  ISSN =	{1868-8969},
  year =	{2016},
  volume =	{56},
  editor =	{Shriram Krishnamurthi and Benjamin S. Lerner},
  publisher =	{Schloss Dagstuhl--Leibniz-Zentrum fuer Informatik},
  address =	{Dagstuhl, Germany},
  URL =		{},
  URN =		{urn:nbn:de:0030-drops-61128},
  doi =		{10.4230/LIPIcs.ECOOP.2016.18},
  annote =	{Keywords: JSON, Type System, Polymorphic Record Calculus}

Keywords: JSON, Type System, Polymorphic Record Calculus
Collection: 30th European Conference on Object-Oriented Programming (ECOOP 2016)
Issue Date: 2016
Date of publication: 18.07.2016

DROPS-Home | Fulltext Search | Imprint | Privacy Published by LZI