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

Conflicts

None