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-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"

  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 >= "3.0.1"
  9. atdgen-runtime >= "2.10.0"
  10. atdml
  11. atproto
  12. avro-compiler
  13. avro-simple
  14. aws-config
  15. aws-eio
  16. aws-s3 < "4.5.1" | >= "4.8.0"
  17. awskit-lwt-unix
  18. awskit-s3
  19. awsm-codegen
  20. awso
  21. awso-common
  22. bap-radare2
  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" & < "1.2.0"
  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. curve448
  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-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. 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.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 >= "3.0.0"
  141. kremlin < "transition"
  142. kube
  143. kubecaml
  144. lablgtk3-extras >= "3.0.1"
  145. lambdapi
  146. landmarks-speedscope
  147. learn-ocaml
  148. letsencrypt < "2.0.0"
  149. letters
  150. libsail
  151. lichess_api
  152. linol >= "0.2" & < "0.10"
  153. linol-eio
  154. linol-lwt
  155. lockfree >= "0.3.1"
  156. logs-async-reporter >= "1.3"
  157. lsp < "1.6.0" | >= "1.23.1"
  158. melange-edn >= "0.5.0"
  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. 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 < "1.10.5" | >= "1.18.0" & != "1.21.0-4.14" & != "1.23.0"
  180. ocaml-protoc-plugin >= "6.1.0"
  181. ocaml_db_model
  182. ocaml_pgsql_model
  183. ocamleditor
  184. ocamlgrep-lib
  185. ocf >= "1.0.0"
  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. oxbow
  207. ozulip
  208. pa_ppx < "0.14" | >= "0.19"
  209. pandoc
  210. pbrt_yojson
  211. pds-reachability >= "0.2.3"
  212. pgn_parser
  213. pgn_to_tex
  214. phylogenetics >= "0.2.0"
  215. pidgio-yojson
  216. piece_rope
  217. pkcs11-driver >= "1.0.0"
  218. playwright
  219. polymarket
  220. ppx_deriving_jsonschema
  221. ppx_deriving_yojson < "3.6.1"
  222. ppx_hegel_test
  223. ppx_protocol_conv_json >= "5.2.1"
  224. ppx_yojson
  225. ppx_yojson_conv_lib
  226. ppxlib-tools >= "0.37.0"
  227. prof_spacetime
  228. pxshot
  229. qdrant
  230. qmp >= "0.19.0"
  231. query-json
  232. quests
  233. r2pipe
  234. radare2
  235. rdf
  236. records >= "1.0.0"
  237. repr-bench
  238. rescriptdep
  239. rfsm >= "2.2"
  240. rocq-devtools
  241. rpclib
  242. rungen
  243. rust-staticlib-gen
  244. SZXX
  245. safemoney
  246. saga
  247. sail < "0.15"
  248. saturn
  249. saturn_lockfree
  250. satyrographos >= "0.0.2.8" & < "0.0.2.13"
  251. savvy
  252. semver2
  253. serde_json
  254. server-reason-react >= "0.4.0"
  255. shakuhachi
  256. sihl < "0.2.0" | >= "0.3.0~rc2"
  257. sihl-core
  258. simple_httpd
  259. slack
  260. slug
  261. smaws-lib
  262. smtml >= "0.7.0"
  263. snf_mcp < "0.2.1"
  264. sosie
  265. spectrum_palette_ppx
  266. spotify-web-api
  267. sqlgg >= "20260721"
  268. starred_ml
  269. swagger
  270. talon < "1.0.0~alpha3"
  271. tdigest < "2.1.0"
  272. testcontainers
  273. textmate-language >= "0.3.4"
  274. textrazor >= "0.1.1"
  275. tidy_email_sendgrid
  276. timedesc < "0.8.0"
  277. timedesc-json
  278. timere < "0.4.0"
  279. topup
  280. transom
  281. user-agent-parser
  282. vecosek
  283. vercel
  284. verdict
  285. volgo-vcs >= "0.0.22"
  286. vscoq-language-server < "2.3.3"
  287. vsrocq-language-server
  288. wasm_of_ocaml-compiler
  289. wax
  290. wax-lib
  291. webauthn
  292. why3find
  293. xapi-rrd >= "1.9.0"
  294. yojson-five >= "3.0.0"
  295. yosqlite >= "0.2"
  296. yultracer
  297. zanuda
  298. zarr

Conflicts

None