Json-Type: JSON Push Parsing and Type Checking

The Json-Type Library and Program

Json-Type is a fully-compliant RFC 7159 and ECMA 404 push parser—validating UTF8 as per the Unicode Standard 8.0.0—and an on-the-fly type checker of JSON text. It has a two-tiered structure: the core of its functionality is enclosed in a dynamic library, while the front-end, the main program assembles the variety of use-cases of the library into a convenient and comprehensive command line interface.

Json-Type was first and foremost designed for employing its main service—the type checking of JSON texts—in shell scripts that call in Web services programmatically. The program and the library are able to handle gracefully, securely and very efficiently such scenarios as when Web services are sending back huge amounts of JSON data.

The type checker of Json-Type is kind of unconventional: it does not build any kind of a DOM tree nor an AST of its JSON input prior to proceed with type validation. Alternatively, the type checker runs alongside the parser, obeying the very logic of the push-parsing itself: while consuming given chunks of input text one at a time, it stops as soon as it is detecting a type error occurrence in the input given.

The Json-Litex Filtering Library

The main program of Json-Type is provided with an extension mechanism by which dynamic libraries of a preestablished form are loaded dynamically at run time and ran upon specifications given by the user. The dynamic libraries interpose between Json-Type's input and output classes, are chained one upon another like programs in a Unix pipeline command and are able to apply any sort of processing they need.

An optional component of Json-Type, Json-Litex is such a filter library, which augments Json-Type's main functionality of JSON text type checking: using PCRE2 library, Json-Litex verifies that the literals in the input text do satisfy constraints defined by so-called literal expressions.

Downloading

The source code tarballs for all releases of Json-Type are available from project's download area on Savannah. The current development sources can be browsed using cgit or gitweb or can be retrieved locally with the command:

$ git clone git://git.sv.nongnu.org/json-type

Json-Type releases are signed by Stefan Vargyas. His key is available on Savannah. Each released tarball is paired by a .sig file which contains the digital signature created by GnuPG for the respective tarball. The procedure of verifying a signature is straightforward (see the GnuPG FAQ).

Documentation

The README file—to be found in the top directory of the source tree—describes the main program of Json-Type in section 4, Primary Use Cases of Json-Type.

Two more files in the doc directory—type-spec.txt and type-samples.txt—add more depth to the accounts given in the README file. The first of the two files is defining the type system of Json-Type. The second one is showing the way the types of Json-Type are applied to validating the JSON output provided by the Web service APIs of one popular web site.

The generic extension mechanism of Json-Type—the filtering dynamic libraries—is documented by doc/filter-libs.txt. The Json-Litex filtering library is presented in all its details in doc/liter-expr.txt. A special section of this latter document extends the Web service API example shown in doc/type-samples.txt by adding literal expression constraints checking to the JSON output obtained from the respective web site.

Mailing Etiquette

Please do not send messages encoded as HTML, nor encoded as base64 MIME, nor included as multiple formats. Please send messages as plain text. Please include a descriptive subject line. Please avoid sending large messages, without prior contact.

Licensing

Json-Type is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

Author

The author of this software is Stefan Vargyas <stvar@yahoo.com>.

Copyright © 2016, 2017, 2018, 2019   Stefan Vargyas