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. a2a-client
  3. abella >= "2.0.8"
  4. acgtk
  5. amlc-lsp
  6. anthropic
  7. archetype
  8. atd >= "2.6.0"
  9. atdgen >= "3.0.1"
  10. atdgen-runtime >= "2.10.0"
  11. atdml
  12. atproto
  13. avro-compiler
  14. avro-simple
  15. aws-config
  16. aws-eio
  17. aws-s3 < "4.5.1" | >= "4.8.0"
  18. awskit-lwt-unix
  19. awskit-s3
  20. awsm-codegen
  21. awso
  22. awso-common
  23. bap-radare2
  24. bhttp
  25. bitcoin >= "3.0"
  26. bitflyer
  27. bizowie-api
  28. boulangerie
  29. boulodrome
  30. builder-web >= "0.2.0"
  31. cabal
  32. caisar
  33. calculon
  34. camelot >= "1.4.2"
  35. camels
  36. canary
  37. catala = "0.9.0" | >= "1.0.0~beta" & < "1.2.0" | >= "1.3.0"
  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-cil >= "1.8.0"
  101. gopcaml-mode-merlin < "0.0.6"
  102. grace >= "0.4.0"
  103. gradescope_submit
  104. graphql < "0.9.0" | >= "0.14.0"
  105. graphql-async >= "0.14.0"
  106. graphql-cohttp >= "0.13.0"
  107. graphql-lwt >= "0.14.0"
  108. graphql_ppx
  109. gremlin
  110. guardian
  111. h2
  112. hacl_x25519
  113. handlebars-ml
  114. hegel < "0.24.1"
  115. hilite < "0.3.0"
  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.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 >= "3.0.0"
  145. kremlin < "transition"
  146. kube
  147. kubecaml
  148. lablgtk3-extras >= "3.0.1"
  149. lambdapi
  150. landmarks-speedscope
  151. learn-ocaml
  152. letsencrypt < "2.0.0"
  153. letters
  154. libsail
  155. lichess_api
  156. linol >= "0.2" & < "0.10" | >= "0.12"
  157. linol-eio
  158. linol-lwt
  159. lockfree >= "0.3.1"
  160. logs-async-reporter >= "1.3"
  161. lsp < "1.6.0" | >= "1.23.1"
  162. melange-edn >= "0.5.0"
  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. multicore-bench
  174. mutaml
  175. nats-client
  176. nats-client-async
  177. neo4j_bolt
  178. nloge
  179. noise
  180. nsq
  181. obuilder
  182. ocaml-ai-sdk
  183. ocaml-lsp-server < "1.10.5" | >= "1.18.0" & != "1.21.0-4.14" & != "1.23.0"
  184. ocaml-protoc-plugin >= "6.1.0"
  185. ocaml_db_model
  186. ocaml_pgsql_model
  187. ocamleditor
  188. ocamlgrep-lib
  189. ocf >= "1.0.0"
  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. oxbow
  212. ozulip
  213. pa_ppx < "0.14" | >= "0.19"
  214. pandoc
  215. pbrt_yojson
  216. pds-reachability >= "0.2.3"
  217. pgn_parser
  218. pgn_to_tex
  219. phylogenetics >= "0.2.0"
  220. pidgio-yojson
  221. piece_rope
  222. pkcs11-driver >= "1.0.0"
  223. playwright
  224. polymarket
  225. ppx_deriving_jsonschema
  226. ppx_deriving_yojson < "3.6.1"
  227. ppx_hegel_test
  228. ppx_protocol_conv_json >= "5.2.1"
  229. ppx_yojson
  230. ppx_yojson_conv_lib
  231. ppxlib-tools >= "0.37.0"
  232. prof_spacetime
  233. pxshot
  234. qdrant
  235. qmp >= "0.19.0"
  236. query-json
  237. quests
  238. r2pipe
  239. radare2
  240. rdf
  241. records >= "1.0.0"
  242. repr-bench
  243. rescriptdep
  244. rfsm >= "2.2"
  245. rocq-devtools
  246. rpclib
  247. rungen
  248. rust-staticlib-gen
  249. SZXX
  250. safemoney
  251. saga
  252. sail < "0.15"
  253. saturn
  254. saturn_lockfree
  255. satyrographos >= "0.0.2.8" & < "0.0.2.13"
  256. savvy
  257. semver2
  258. serde_json
  259. server-reason-react >= "0.4.0"
  260. shakuhachi
  261. sihl < "0.2.0" | >= "0.3.0~rc2"
  262. sihl-core
  263. simple_httpd
  264. slack
  265. slug
  266. smaws-lib
  267. smtml >= "0.7.0"
  268. snf_mcp < "0.2.1"
  269. sosie
  270. spectrum_palette_ppx
  271. spotify-web-api
  272. sqlgg >= "20260721"
  273. starred_ml
  274. swagger
  275. talon < "1.0.0~alpha3"
  276. tdigest < "2.1.0"
  277. testcontainers
  278. textmate-language >= "0.3.4"
  279. textrazor >= "0.1.1"
  280. tidy_email_sendgrid
  281. timedesc < "0.8.0"
  282. timedesc-json
  283. timere < "0.4.0"
  284. topup
  285. transom
  286. user-agent-parser
  287. vecosek
  288. vercel
  289. verdict
  290. volgo-vcs >= "0.0.22"
  291. vscoq-language-server < "2.3.3"
  292. vsrocq-language-server
  293. wasm_of_ocaml-compiler
  294. wax
  295. wax-lib
  296. webauthn
  297. why3find
  298. xapi-rrd >= "1.9.0"
  299. yojson-five >= "3.0.0"
  300. yosqlite >= "0.2"
  301. yultracer
  302. zanuda
  303. zarr

Conflicts

None