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

Conflicts

None