yojson

Yojson is an optimized parsing and printing library for the JSON format
README

This library parses JSON data into a nested OCaml tree data structure.

Library documentation

Currently at https://ocaml-community.github.io/yojson/

Examples

A simple example on how to parse JSON from a string literal.

let json_string = {|
  {"number" : 42,
   "string" : "yes",
   "list": ["for", "sure", 42]}|}
(* val json_string : string *)

let json = Yojson.Safe.from_string json_string
(* val json : Yojson.Safe.t *)

Format.printf "Parsed to %a" Yojson.Safe.pp json

Related tooling

Yojson is a pretty common choice for parsing JSON in OCaml, as such it is the
base for a number of tools and libraries that are built on top of it.

  • ppx_deriving_yojson to
    automatically generate code that converts between Yojson.Safe.t and custom
    OCaml types

  • ppx_yojson_conv, an
    alternative to ppx_deriving_yojson from Jane Street with different design
    decisions

  • atd, generates mapping code from .atd
    specification files and can be used in multiple languages

  • jsonm is an alternate JSON parser
    that parses JSON into a stream of items, so the complete data structure does
    not have to be in memory.

Help wanted

Yojson is developed and maintained by volunteers — users like you.
Various issues are in need
of attention. If you'd like to contribute, please leave a comment on the issue
you're interested in, or create a new issue. Experienced contributors will
guide you as needed.

There are many simple ways of making a positive impact. For example,
you can...

  • Use the software in your project.

  • Give a demo to your colleagues.

  • Share the passion on your blog.

  • Tweet about what you're doing with Yojson.

  • Report difficulties by creating new issues. We'll triage them.

  • Ask questions on StackOverflow.

  • Answer questions on
    StackOverflow.

  • Discuss usage on the OCaml forums.

  • Pick a task that's easy
    for you.

Check out in particular
good first time issues
and other issues with which
we could use some help.

License

Yojson is licensed under the 3-clause BSD license, see LICENSE.md for
details.

Install
Sources
yojson-2.0.0.tbz
sha256=ab5d863f7f951a8f7fb4a708399ca2da2cf139a5e0af7818145c20295420cb1a
sha512=3ea982dbeef7ec8da54d29124ddb8b86f90583eb96ed3947851cedec9e3d2d47b981e3465d41f2c94943e6865ba6a9a51c6f0252efa6df2386d398b679aae8f2
Dependencies
seq
>= "0.2.2"
odoc
with-doc
alcotest
with-test & >= "0.8.5"
cppo
build
ocaml
>= "4.02.3"
Reverse Dependencies
0install
< "2.15.1"
acgtk
>= "1.3.2"
atd
>= "2.6.0"
atdgen
< "1.9.0" | >= "1.13.0" & < "2.8.0"
aws
< "1.0.0"
aws-s3
>= "1.1.0" & < "4.5.1"
calculon
!= "0.5"
camelot
>= "1.3.0"
cbor
!= "0.2"
coq-serapi
>= "8.10.0+0.7.0"
current_web
>= "0.4"
datakit-ci
>= "0.12.3"
devkit
>= "0.4"
docker-api
>= "0.2.2"
dot-merlin-reader
!= "4.4~5.0.preview" & < "4.6"
dropbox
>= "0.2"
dune-release
>= "1.4.0"
earlybird
< "1.0.0"
facebook-sdk
< "0.3.1"
frama-c
>= "19.0"
frenetic
>= "3.2.0"
fstar
>= "0.9.3.0-beta1"
gapi-ocaml
< "0.3.5" | >= "0.4.3"
gdbprofiler
>= "0.2"
gen-bs
>= "0.1.0"
goblint-cil
>= "1.8.0"
graphql
< "0.9.0"
graphql-cohttp
>= "0.13.0"
irmin-bench
< "3.0.0"
irmin-graphql
>= "2.2.0"
js_of_ocaml
= "2.8.4"
jsonrpc
< "1.6.0"
lambdapi
>= "2.0.0"
linol
>= "0.2"
merlin
= "3.0.3" | = "4.4.1~5.0preview" | >= "4.6-412"
minimal
>= "1.1.0"
nsq
>= "0.2.4"
oclaunch
< "0.2.1"
odoc
>= "2.0.0"
ogen
= "0.1.2"
ojs-base
!= "0.2.0"
ometrics
< "0.2.0"
opam2web
>= "2.0"
opium
>= "0.19.0"
pkcs11-driver
>= "1.0.0"
plist
>= "1.0.0"
podge
>= "0.4"
ppx_yojson_conv
< "v0.13.0"
qmp
>= "0.19.0"
rdf
>= "0.9.0"
records
= "0.6.0"
rpc
= "2.2.0"
rpclib
>= "6.0.0"
satyrographos
!= "0.0.2.7"
sihl
< "0.2.0" | >= "0.3.0~rc2"
slacko
< "0.14.1"
telegraml
< "2.2.0"
textrazor
>= "0.1.1"
timere
< "0.4.0"