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

Conflicts

None