Skip to content

sealinesun/jsonx

Repository files navigation

Jsonc — JSON data structure codecs for OCaml

%%VERSION%%

Jsonc describes JSON data structures in OCaml with codec combinators. The resulting typed descriptions enable backend JSON codecs to encode and decode these structures from/to OCaml values.

Jsonc's codecs can be used with different backends. The library comes with a Jsonm backend and a JavaScript backend that depends on js_of_ocaml and uses the browsers' builtin JSON codecs.

Jsonc and its backends depend on Jsonm and js_of_ocaml. They are distributed under the ISC license.

Home page: http://erratique.ch/software/jsonc
Contact: Daniel Bünzli <daniel.buenzl i@erratique.ch>

Installation

Jsonc can be installed with opam:

opam install jsonm jsonc             # jsonm backend
opam install js_of_ocaml jsonc       # js_of_ocaml backend
opam install jsonm js_of_ocaml jsonc # all backends

If you don't use opam consult the opam file for build instructions.

Documentation

The documentation and API reference is automatically generated by from the interfaces. It can be consulted online or via odig doc jsonc.

Sample programs

If you installed Jsonc with opam sample programs are located in the directory opam config var jsonc:doc.

In the distribution sample programs are located in the test directory of the distribution. They can be built with:

ocamlbuild -use-ocamlfind test/tests.otarget

The resulting binaries are in _build/test.

  • test.native tests the library, nothing should fail.