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

Conflicts

None