The JSON Library
Author: John Reppy
Keywords: Standard ML, SML, SML/NJ Library

The SML of NJ Library
The JSON Library

## Overview

The JSON Library provides operations on the datatype representation of JSON (JavaScript Object Notation) values. The datatype representation is defined in the `JSON` structure, which is part of the the Util Library. This library provides support for parsing, printing, and manipulating JSON values as trees. There is also support for processing JSON data as streams using a "SAX-style" API.

## Contents

### Tree-based API

`structure JSONParser`

  A parser for JSON input.

`structure JSONPrinter`

  A printer for JSON output.

`structure JSONUtil`

  A collection of utility functions for working with JSON values.

`structure JSONDecode`

  A collection of combinators for decoding JSON values.

### Stream-based API

`structure JSONStreamParser`

  A stream (or event) based parser for JSON input.

`signature JSON_STREAM_OUTPUT`

  The interface to a stream-based printer for JSON output.

`structure JSONBufferPrinter`

  A stream-based printer for JSON output to character buffers.

`structure JSONStreamPrinter`

  A stream-based printer for JSON output to text files.

## Usage

For SML/NJ, include `$/json-lib.cm` in your CM file.

For use in MLton, include `$(SML_LIB)/smlnj-lib/JSON/json-lib.mlb` in your MLB file.

SML/NJ Version 110.99.9 (November 4, 2025)
Last updated 2025-11-04 15:48:25 UTC