Main Software Downloads Other

Yojson [difficulty = 1 camel]

Introduction

Yojson is an optimized parsing and printing library for the JSON format. It addresses a few shortcomings of json-wheel including 2x speedup, polymorphic variants and optional syntax for tuples and variants.

ydump is a pretty-printing command-line program provided with the yojson package.

The program atdgen can be used to derive OCaml-JSON serializers and deserializers from type definitions.

JSON extensions

The yojson implementation follows RFC 4627 except for the following features. These syntax extensions are supported by the yojson readers and can be disabled by the writers when standard JSON is required.

Note that yojson never checks the encoding of strings. All ASCII-compatible encodings including UTF-8 are supported by yojson readers and writers. Non-ASCII-compatible encodings UTF-16BE, UTF-16LE, UTF-32BE and UTF-32LE are not supported. "\uXXXX" escape sequences are converted by the readers into the equivalent UTF-8 multibyte sequences. Characters outside the ASCII range are always written as is, as permitted by the JSON standard. Bytes that do not form valid UTF-8 characters are also output as is. It is the user's responsibility to check for the correctness of UTF-8 data when appropriate.

Library documentation

Download

This software was written by Martin Jambon. It is distributed under a BSD license. The current version is 1.0.3 and requires biniou 1.0.0 or higher. See Changes. Download it here.

The development version of Yojson is hosted on GitHub.