package yojson

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

Install

dune-project
 Dependency

Authors

Maintainers

Sources

yojson-2.2.2.tbz
sha256=9abfad8c9a79d4723ad2f6448e669c1e68dbfc87cc54a1b7c064b0c90912c595
sha512=ac52eae3ca1d3129a7885ca638e6ae5bcfc387598a82cc30d3e4988fd154f1756719c399f96e950d898c79a6dbd4ccc44b6f468bcafbd620e6945a0415b41e0c

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 (3)

  1. seq >= "0.2.2"
  2. ocaml >= "4.02.3"
  3. dune >= "2.7"

Dev Dependencies (2)

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

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

Conflicts

None