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. avro-compiler
  12. avro-simple
  13. aws-config
  14. aws-eio
  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. 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" & < "1.2.0"
  34. cbor >= "0.3"
  35. cdp
  36. cdp-gen
  37. chess_com_api
  38. colibrics
  39. comby-semantic
  40. commons
  41. containers >= "3.9"
  42. contract
  43. coq-lsp
  44. coq-of-ocaml
  45. coq-serapi < "8.20.0+0.20.0"
  46. crs >= "0.0.20250705"
  47. current_docker
  48. current_examples
  49. current_git
  50. current_github
  51. current_gitlab
  52. current_slack
  53. current_ssh
  54. current_web
  55. dap
  56. daypack-lib
  57. dblp-api
  58. decoders-yojson >= "0.7.0"
  59. devkit
  60. dnsrobot
  61. docker-api >= "0.2.2"
  62. docker_hub
  63. dot-merlin-reader < "4.9"
  64. dream
  65. dream-inertia
  66. dune-cargo-build
  67. dune-release >= "1.4.0"
  68. dune_deps_extra
  69. ecma-regex
  70. eio_main >= "0.10"
  71. elasticsearch-cli = "0.5"
  72. elpi >= "3.3.1"
  73. esgg >= "20260908"
  74. fehu < "1.0.0~alpha3"
  75. fiat-p256
  76. fit >= "1.2.0"
  77. forester >= "3.1.0"
  78. frama-c < "23.0" | >= "27.0~beta"
  79. fred
  80. frenetic
  81. fstar
  82. fxmacrodata
  83. gapi-ocaml
  84. gdbprofiler
  85. gemini
  86. gendarme-json < "0.4.0"
  87. gendarme-yojson
  88. github != "4.0.0"
  89. github-data
  90. github-unix >= "4.5.1"
  91. gitlab
  92. gmocoin
  93. goblint-cil >= "1.8.0"
  94. gopcaml-mode-merlin < "0.0.6"
  95. grace >= "0.4.0"
  96. gradescope_submit
  97. graphql < "0.9.0" | >= "0.14.0"
  98. graphql-async >= "0.14.0"
  99. graphql-cohttp >= "0.13.0"
  100. graphql-lwt >= "0.14.0"
  101. graphql_ppx
  102. gremlin
  103. guardian
  104. h2
  105. hacl_x25519
  106. handlebars-ml
  107. hegel
  108. hilite < "0.3.0"
  109. hockmd
  110. hpack
  111. hpke
  112. hsluv
  113. httph
  114. huml
  115. huml-cli
  116. index-bench
  117. ip2location
  118. ip2locationio
  119. ip2whois
  120. irmin-graphql
  121. irmin-tezos
  122. jasmin
  123. jhupllib
  124. jose
  125. js_of_ocaml-compiler
  126. jsonkit
  127. jsonrpc >= "1.23.1"
  128. jsonschema
  129. jsonschema-core
  130. jsonschema2atd
  131. jupyter
  132. jupyter-kernel
  133. jwto
  134. kappa-library < "4.1.3"
  135. karamel
  136. kaun >= "1.0.0~alpha1" & < "1.0.0~alpha3"
  137. kind2 >= "3.0.0"
  138. kremlin < "transition"
  139. kubecaml
  140. lablgtk3-extras >= "3.0.1"
  141. lambdapi
  142. landmarks-speedscope
  143. learn-ocaml
  144. letsencrypt < "2.0.0"
  145. letters
  146. libsail
  147. lichess_api
  148. linol >= "0.2" & < "0.10"
  149. linol-eio
  150. linol-lwt
  151. lockfree >= "0.3.1"
  152. logs-async-reporter >= "1.3"
  153. lsp < "1.6.0" | >= "1.23.1"
  154. melange-edn >= "0.5.0"
  155. melange-json = "1.2.0"
  156. melange-json-native
  157. merlin != "4.5-411"
  158. metadb
  159. miaou-core
  160. miaou-driver-web
  161. mirage-crypto-ec
  162. mjson
  163. monorobot
  164. mopsa
  165. multicore-bench
  166. mutaml
  167. nats-client
  168. nats-client-async
  169. neo4j_bolt
  170. nloge
  171. noise
  172. nsq
  173. obuilder
  174. ocaml-ai-sdk
  175. ocaml-lsp-server < "1.10.5" | >= "1.18.0" & != "1.21.0-4.14" & != "1.23.0"
  176. ocaml-protoc-plugin >= "6.1.0"
  177. ocaml_db_model
  178. ocaml_pgsql_model
  179. ocamleditor
  180. ocamlgrep-lib
  181. ocf >= "1.0.0"
  182. ochre
  183. ocsigen-start
  184. odoc >= "3.0.0"
  185. odoc-driver
  186. oframl
  187. oidc
  188. ojs-base
  189. ojs_base
  190. ometrics < "0.2.0"
  191. opam-check-npm-deps >= "4.1.0"
  192. openai-gym
  193. openapi
  194. openapi_router
  195. opencage
  196. openstellina
  197. opium >= "0.19.0"
  198. oraft
  199. orun
  200. osh
  201. oui
  202. oxbow
  203. ozulip
  204. pa_ppx < "0.14" | >= "0.19"
  205. pandoc
  206. pbrt_yojson
  207. pds-reachability >= "0.2.3"
  208. pgn_parser
  209. pgn_to_tex
  210. phylogenetics >= "0.2.0"
  211. pidgio-yojson
  212. piece_rope
  213. pkcs11-driver >= "1.0.0"
  214. playwright
  215. polymarket
  216. ppx_deriving_jsonschema
  217. ppx_deriving_yojson < "3.6.1"
  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. query-json
  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" & < "0.0.2.13"
  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 < "0.2.1"
  260. sosie
  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 >= "3.0.0"
  290. yosqlite >= "0.2"
  291. yultracer
  292. zanuda
  293. zarr

Conflicts

None