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

Conflicts

None