package yojson

Build not checked
  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"

Optional Dependencies

None

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

Conflicts

None

Build status

Results of building yojson with each compiler on check.ci.ocaml.org, run of against opam-repository 8a77e58. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

This version is not in the latest run; the versions below are.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
3.0.0 good good good good good
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure