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. atproto
  12. avro-compiler
  13. avro-simple
  14. aws-config
  15. aws-eio
  16. aws-s3 < "4.5.1" | >= "4.8.0"
  17. awskit-lwt-unix
  18. awskit-s3
  19. awsm-codegen
  20. awso
  21. awso-common
  22. bap-radare2
  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" & < "1.2.0" | >= "1.3.0"
  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-cil >= "1.8.0"
  98. gopcaml-mode-merlin < "0.0.6"
  99. grace >= "0.4.0"
  100. gradescope_submit
  101. graphql < "0.9.0" | >= "0.14.0"
  102. graphql-async >= "0.14.0"
  103. graphql-cohttp >= "0.13.0"
  104. graphql-lwt >= "0.14.0"
  105. graphql_ppx
  106. gremlin
  107. guardian
  108. h2
  109. hacl_x25519
  110. handlebars-ml
  111. hegel < "0.24.1"
  112. hilite < "0.3.0"
  113. hockmd
  114. hpack
  115. hpke
  116. hsluv
  117. httph
  118. huml
  119. huml-cli
  120. index-bench
  121. ip2location
  122. ip2locationio
  123. ip2whois
  124. irmin-graphql
  125. irmin-tezos
  126. jasmin
  127. jhupllib
  128. jose
  129. js_of_ocaml-compiler
  130. jsonkit
  131. jsonrpc >= "1.23.1"
  132. jsonschema
  133. jsonschema-core
  134. jsonschema2atd
  135. jupyter
  136. jupyter-kernel
  137. jwto
  138. kappa-library < "4.1.3"
  139. karamel
  140. kaun >= "1.0.0~alpha1" & < "1.0.0~alpha3"
  141. kind2 >= "3.0.0"
  142. kremlin < "transition"
  143. kube
  144. kubecaml
  145. lablgtk3-extras >= "3.0.1"
  146. lambdapi
  147. landmarks-speedscope
  148. learn-ocaml
  149. letsencrypt < "2.0.0"
  150. letters
  151. libsail
  152. lichess_api
  153. linol >= "0.2" & < "0.10" | >= "0.12"
  154. linol-eio
  155. linol-lwt
  156. lockfree >= "0.3.1"
  157. logs-async-reporter >= "1.3"
  158. lsp < "1.6.0" | >= "1.23.1"
  159. melange-edn >= "0.5.0"
  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. multicore-bench
  171. mutaml
  172. nats-client
  173. nats-client-async
  174. neo4j_bolt
  175. nloge
  176. noise
  177. nsq
  178. obuilder
  179. ocaml-ai-sdk
  180. ocaml-lsp-server < "1.10.5" | >= "1.18.0" & != "1.21.0-4.14" & != "1.23.0"
  181. ocaml-protoc-plugin >= "6.1.0"
  182. ocaml_db_model
  183. ocaml_pgsql_model
  184. ocamleditor
  185. ocamlgrep-lib
  186. ocf >= "1.0.0"
  187. ochre
  188. ocsigen-start
  189. odoc >= "3.0.0"
  190. odoc-driver
  191. oframl
  192. ohttp
  193. oidc
  194. ojs-base
  195. ojs_base
  196. ometrics < "0.2.0"
  197. opam-check-npm-deps >= "4.1.0"
  198. openai-gym
  199. openapi
  200. openapi_router
  201. opencage
  202. openstellina
  203. opium >= "0.19.0"
  204. oraft
  205. orun
  206. osh
  207. oui
  208. oxbow
  209. ozulip
  210. pa_ppx < "0.14" | >= "0.19"
  211. pandoc
  212. pbrt_yojson
  213. pds-reachability >= "0.2.3"
  214. pgn_parser
  215. pgn_to_tex
  216. phylogenetics >= "0.2.0"
  217. pidgio-yojson
  218. piece_rope
  219. pkcs11-driver >= "1.0.0"
  220. playwright
  221. polymarket
  222. ppx_deriving_jsonschema
  223. ppx_deriving_yojson < "3.6.1"
  224. ppx_hegel_test
  225. ppx_protocol_conv_json >= "5.2.1"
  226. ppx_yojson
  227. ppx_yojson_conv_lib
  228. ppxlib-tools >= "0.37.0"
  229. prof_spacetime
  230. pxshot
  231. qdrant
  232. qmp >= "0.19.0"
  233. query-json
  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" & < "0.0.2.13"
  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 < "0.2.1"
  266. sosie
  267. spectrum_palette_ppx
  268. spotify-web-api
  269. sqlgg >= "20260721"
  270. starred_ml
  271. swagger
  272. talon < "1.0.0~alpha3"
  273. tdigest < "2.1.0"
  274. testcontainers
  275. textmate-language >= "0.3.4"
  276. textrazor >= "0.1.1"
  277. tidy_email_sendgrid
  278. timedesc < "0.8.0"
  279. timedesc-json
  280. timere < "0.4.0"
  281. topup
  282. transom
  283. user-agent-parser
  284. vecosek
  285. vercel
  286. verdict
  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 >= "3.0.0"
  297. yosqlite >= "0.2"
  298. yultracer
  299. zanuda
  300. zarr

Conflicts

None