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

Conflicts

None