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. 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" & < "1.2.0"
  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-cil >= "1.8.0"
  95. gopcaml-mode-merlin < "0.0.6"
  96. grace >= "0.4.0"
  97. gradescope_submit
  98. graphql < "0.9.0" | >= "0.14.0"
  99. graphql-async >= "0.14.0"
  100. graphql-cohttp >= "0.13.0"
  101. graphql-lwt >= "0.14.0"
  102. graphql_ppx
  103. gremlin
  104. guardian
  105. h2
  106. hacl_x25519
  107. handlebars-ml
  108. hegel
  109. hilite < "0.3.0"
  110. hockmd
  111. hpack
  112. hpke
  113. hsluv
  114. httph
  115. huml
  116. huml-cli
  117. index-bench
  118. ip2location
  119. ip2locationio
  120. ip2whois
  121. irmin-graphql
  122. irmin-tezos
  123. jasmin
  124. jhupllib
  125. jose
  126. js_of_ocaml-compiler
  127. jsonkit
  128. jsonrpc >= "1.23.1"
  129. jsonschema
  130. jsonschema-core
  131. jsonschema2atd
  132. jupyter
  133. jupyter-kernel
  134. jwto
  135. kappa-library < "4.1.3"
  136. karamel
  137. kaun >= "1.0.0~alpha1" & < "1.0.0~alpha3"
  138. kind2 >= "3.0.0"
  139. kremlin < "transition"
  140. kube
  141. kubecaml
  142. lablgtk3-extras >= "3.0.1"
  143. lambdapi
  144. landmarks-speedscope
  145. learn-ocaml
  146. letsencrypt < "2.0.0"
  147. letters
  148. libsail
  149. lichess_api
  150. linol >= "0.2" & < "0.10"
  151. linol-eio
  152. linol-lwt
  153. lockfree >= "0.3.1"
  154. logs-async-reporter >= "1.3"
  155. lsp < "1.6.0" | >= "1.23.1"
  156. melange-edn >= "0.5.0"
  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. multicore-bench
  168. mutaml
  169. nats-client
  170. nats-client-async
  171. neo4j_bolt
  172. nloge
  173. noise
  174. nsq
  175. obuilder
  176. ocaml-ai-sdk
  177. ocaml-lsp-server < "1.10.5" | >= "1.18.0" & != "1.21.0-4.14" & != "1.23.0"
  178. ocaml-protoc-plugin >= "6.1.0"
  179. ocaml_db_model
  180. ocaml_pgsql_model
  181. ocamleditor
  182. ocamlgrep-lib
  183. ocf >= "1.0.0"
  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. oxbow
  205. ozulip
  206. pa_ppx < "0.14" | >= "0.19"
  207. pandoc
  208. pbrt_yojson
  209. pds-reachability >= "0.2.3"
  210. pgn_parser
  211. pgn_to_tex
  212. phylogenetics >= "0.2.0"
  213. pidgio-yojson
  214. piece_rope
  215. pkcs11-driver >= "1.0.0"
  216. playwright
  217. polymarket
  218. ppx_deriving_jsonschema
  219. ppx_deriving_yojson < "3.6.1"
  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. query-json
  230. quests
  231. r2pipe
  232. radare2
  233. rdf
  234. records >= "1.0.0"
  235. repr-bench
  236. rescriptdep
  237. rfsm >= "2.2"
  238. rocq-devtools
  239. rpclib
  240. rungen
  241. rust-staticlib-gen
  242. SZXX
  243. safemoney
  244. saga
  245. sail < "0.15"
  246. saturn
  247. saturn_lockfree
  248. satyrographos >= "0.0.2.8" & < "0.0.2.13"
  249. savvy
  250. semver2
  251. serde_json
  252. server-reason-react >= "0.4.0"
  253. shakuhachi
  254. sihl < "0.2.0" | >= "0.3.0~rc2"
  255. sihl-core
  256. simple_httpd
  257. slack
  258. slug
  259. smaws-lib
  260. smtml >= "0.7.0"
  261. snf_mcp < "0.2.1"
  262. sosie
  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 >= "3.0.0"
  292. yosqlite >= "0.2"
  293. yultracer
  294. zanuda
  295. zarr

Conflicts

None