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

Conflicts

None

Build status

Results of building yojson with each compiler on check.ci.ocaml.org, run of against opam-repository 8d8d144. 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