package yojson

All checked builds pass
  1. Overview
  2. Docs
Yojson is an optimized parsing and printing library for the JSON format

Install

dune-project
 Dependency

Authors

Maintainers

Sources

yojson-3.0.0.tbz
sha256=99414da7609b92a02474ef4b49ecda15edc8cbba5229341b124e7e4695c39610
sha512=896d0ea829a36ccadba6628800369c1a3ab9e7c64dbda8b76331889c9db481cd64e137f467481ae80a8dd5fca45d748bfa71f58641806cc1bb1a007f8291789f

Description

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

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

Added to opam-repository:

README

Yojson: JSON library for OCaml

Build Status

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 *)

let () = Format.printf "Parsed to %a" Yojson.Safe.pp json

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.

Dependencies (2)

  1. ocaml >= "4.08"
  2. dune >= "2.7"

Dev Dependencies (2)

  1. odoc with-doc
  2. alcotest with-test & >= "0.8.5"

Optional Dependencies

None

  1. 0install >= "2.18"
  2. a2a-client
  3. abella >= "2.0.8"
  4. acgtk
  5. amlc-lsp
  6. anthropic
  7. archetype
  8. atd >= "2.6.0"
  9. atdgen >= "3.0.1"
  10. atdgen-runtime >= "2.10.0"
  11. atdml
  12. atproto
  13. avro-compiler
  14. avro-simple
  15. aws-config
  16. aws-eio
  17. aws-s3 < "4.5.1" | >= "4.8.0"
  18. awskit-lwt-unix
  19. awskit-s3
  20. awsm-codegen
  21. awso
  22. awso-common
  23. bap-radare2
  24. bhttp
  25. bitcoin >= "3.0"
  26. bitflyer
  27. bizowie-api
  28. boulangerie
  29. boulodrome
  30. builder-web >= "0.2.0"
  31. cabal
  32. cabal_workflow_runner
  33. caisar
  34. calculon
  35. camelot >= "1.4.2"
  36. camels
  37. canary
  38. catala = "0.9.0" | >= "1.0.0~beta" & < "1.2.0" | >= "1.3.0"
  39. cbor >= "0.3"
  40. cdp
  41. cdp-gen
  42. chess_com_api
  43. colibrics
  44. comby-semantic
  45. commons
  46. containers >= "3.9"
  47. contract
  48. coq-lsp
  49. coq-of-ocaml
  50. coq-serapi < "8.20.0+0.20.0"
  51. cosmetyc
  52. crs >= "0.0.20250705"
  53. current_docker
  54. current_examples
  55. current_git
  56. current_github
  57. current_gitlab
  58. current_slack
  59. current_ssh
  60. current_web
  61. curve448
  62. dap
  63. daypack-lib
  64. dblp-api
  65. decoders-yojson >= "0.7.0"
  66. devkit
  67. dnsrobot
  68. docker-api >= "0.2.2"
  69. docker_hub
  70. dot-merlin-reader < "4.9"
  71. dream
  72. dream-inertia
  73. dune-cargo-build
  74. dune-release >= "1.4.0"
  75. dune_deps_extra
  76. ecma-regex
  77. eio_main >= "0.10"
  78. elasticsearch-cli = "0.5"
  79. elpi >= "3.3.1"
  80. elpi-lsp
  81. esgg >= "20260908"
  82. fehu < "1.0.0~alpha3"
  83. fiat-p256
  84. fit >= "1.2.0"
  85. forester >= "3.1.0"
  86. frama-c < "23.0" | >= "27.0~beta"
  87. fred
  88. frenetic
  89. fstar
  90. fxmacrodata
  91. gapi-ocaml
  92. gdbprofiler
  93. gemini
  94. gendarme-json < "0.4.0"
  95. gendarme-yojson
  96. github != "4.0.0"
  97. github-data
  98. github-unix >= "4.5.1"
  99. gitlab
  100. gmocoin
  101. goblint-cil >= "1.8.0"
  102. gopcaml-mode-merlin < "0.0.6"
  103. grace >= "0.4.0"
  104. gradescope_submit
  105. graphql < "0.9.0" | >= "0.14.0"
  106. graphql-async >= "0.14.0"
  107. graphql-cohttp >= "0.13.0"
  108. graphql-lwt >= "0.14.0"
  109. graphql_ppx
  110. gremlin
  111. guardian
  112. h2
  113. hacl_x25519
  114. handlebars-ml
  115. hegel < "0.24.1"
  116. hilite < "0.3.0"
  117. hockmd
  118. hpack
  119. hpke
  120. hsluv
  121. httph
  122. huml
  123. huml-cli
  124. index-bench
  125. ip2location
  126. ip2locationio
  127. ip2whois
  128. irmin-graphql
  129. irmin-tezos
  130. jasmin
  131. jhupllib
  132. jose
  133. js_of_ocaml-compiler
  134. jsonkit
  135. jsonrpc >= "1.23.1"
  136. jsonschema
  137. jsonschema-core
  138. jsonschema2atd
  139. jupyter
  140. jupyter-kernel
  141. jwto
  142. kappa-library < "4.1.3"
  143. karamel
  144. kaun >= "1.0.0~alpha1" & < "1.0.0~alpha3"
  145. kind2 >= "3.0.0"
  146. kremlin < "transition"
  147. kube
  148. kubecaml
  149. lablgtk3-extras >= "3.0.1"
  150. lambdapi
  151. landmarks-speedscope
  152. learn-ocaml
  153. letsencrypt < "2.0.0"
  154. letters
  155. libsail
  156. lichess_api
  157. linol >= "0.2" & < "0.10" | >= "0.12"
  158. linol-eio
  159. linol-lwt
  160. lockfree >= "0.3.1"
  161. logs-async-reporter >= "1.3"
  162. lsp < "1.6.0" | >= "1.23.1"
  163. mcp-kit
  164. melange-edn >= "0.5.0"
  165. melange-json = "1.2.0"
  166. melange-json-native
  167. merlin != "4.5-411"
  168. metadb
  169. miaou-core
  170. miaou-driver-web
  171. mirage-crypto-ec
  172. mjson
  173. modelkit-xgboost
  174. monorobot
  175. mopsa
  176. multicore-bench
  177. mutaml
  178. nanofuzz_runtime
  179. nats-client
  180. nats-client-async
  181. neo4j_bolt
  182. nloge
  183. noise
  184. nsq
  185. obuilder
  186. ocaml-ai-sdk
  187. ocaml-lsp-server < "1.10.5" | >= "1.18.0" & != "1.21.0-4.14" & != "1.23.0"
  188. ocaml-protoc-plugin >= "6.1.0"
  189. ocaml_db_model
  190. ocaml_pgsql_model
  191. ocamleditor
  192. ocamlgrep-lib
  193. ocf >= "1.0.0"
  194. ochre
  195. ocsigen-start
  196. odoc >= "3.0.0"
  197. odoc-driver
  198. oframl
  199. ohttp
  200. oidc
  201. ojs-base
  202. ojs_base
  203. ometrics < "0.2.0"
  204. opam-check-npm-deps >= "4.1.0"
  205. openai-gym
  206. openapi
  207. openapi-dsl
  208. openapi_router
  209. opencage
  210. openstellina
  211. opium >= "0.19.0"
  212. oraft
  213. orun
  214. osh
  215. oui
  216. oxbow
  217. ozulip
  218. pa_ppx < "0.14" | >= "0.19"
  219. pandoc
  220. pbrt_yojson
  221. pds-reachability >= "0.2.3"
  222. pgn_parser
  223. pgn_to_tex
  224. phylogenetics >= "0.2.0"
  225. pidgio-yojson
  226. piece_rope
  227. pkcs11-driver >= "1.0.0"
  228. playwright
  229. polymarket
  230. ppx_deriving_jsonschema
  231. ppx_deriving_yojson < "3.6.1"
  232. ppx_hegel_test
  233. ppx_protocol_conv_json >= "5.2.1"
  234. ppx_yojson
  235. ppx_yojson_conv_lib
  236. ppxlib-tools >= "0.37.0"
  237. prof_spacetime
  238. pxshot
  239. qdrant
  240. qmp >= "0.19.0"
  241. query-json
  242. quests
  243. quint-connect
  244. r2pipe
  245. radare2
  246. rdf
  247. records >= "1.0.0"
  248. repr-bench
  249. rescriptdep
  250. rfsm >= "2.2"
  251. rocq-devtools
  252. rpclib
  253. rungen
  254. rust-staticlib-gen
  255. SZXX
  256. safemoney
  257. saga
  258. sail < "0.15"
  259. saturn
  260. saturn_lockfree
  261. satyrographos >= "0.0.2.8" & < "0.0.2.13"
  262. savvy
  263. semver2
  264. serde_json
  265. server-reason-react >= "0.4.0"
  266. shakuhachi
  267. sihl < "0.2.0" | >= "0.3.0~rc2"
  268. sihl-core
  269. simple_httpd
  270. slack
  271. slug
  272. smaws-lib
  273. smtml >= "0.7.0"
  274. snf_mcp < "0.2.1"
  275. sosie
  276. spectrum_palette_ppx
  277. spotify-web-api
  278. sqlgg >= "20260721"
  279. starred_ml
  280. swagger
  281. talon < "1.0.0~alpha3"
  282. tdigest < "2.1.0"
  283. testcontainers
  284. textmate-language >= "0.3.4"
  285. textrazor >= "0.1.1"
  286. tidy_email_sendgrid
  287. timedesc < "0.8.0"
  288. timedesc-json
  289. timere < "0.4.0"
  290. topup
  291. transom
  292. user-agent-parser
  293. vecosek
  294. vercel
  295. verdict
  296. volgo-vcs >= "0.0.22"
  297. vscoq-language-server < "2.3.3"
  298. vsrocq-language-server
  299. wasm_of_ocaml-compiler
  300. wax
  301. wax-lib
  302. webauthn
  303. why3find
  304. xapi-rrd >= "1.9.0"
  305. yojson-five >= "3.0.0"
  306. yosqlite >= "0.2"
  307. yultracer
  308. zanuda
  309. zarr

Conflicts

None

Build status

Results of building yojson with each compiler on check.ci.ocaml.org, run of against opam-repository 8a77e58. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
3.0.0 (this version) good good good good good
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure