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

Conflicts

None