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