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.1.2.tbz
sha256=59f2f1abbfc8a7ccbdbf608894e5c75e8a76006e34899254446f83e200dfb4f9
sha512=309cba7568dec51de20c7ab8df033258c275b8d58b0a36a66b26e673a3bc050cbd7e39ff8fe4796e89263e125bcc21e04dc36a394f3cc201956887eee1fb281a

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 (4)

  1. seq >= "0.2.2"
  2. cppo build
  3. ocaml >= "4.02.3"
  4. 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" & < "0.0.20260307"
  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-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. 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
  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. monorobot
  174. mopsa
  175. morbig >= "0.11.0"
  176. multicore-bench
  177. mutaml
  178. nanofuzz_runtime
  179. nats-client
  180. nats-client-async
  181. neo4j_bolt
  182. nloge
  183. noise
  184. nsq
  185. obuilder
  186. ocaml-lsp-server
  187. ocaml-protoc-plugin >= "6.1.0"
  188. ocaml_db_model
  189. ocaml_pgsql_model
  190. ocamleditor
  191. ocf
  192. ochre
  193. ocsigen-start
  194. odoc >= "3.0.0"
  195. odoc-driver
  196. oframl
  197. ohttp
  198. oidc
  199. ojs-base
  200. ojs_base
  201. ometrics < "0.2.0"
  202. opam-check-npm-deps >= "4.1.0"
  203. openai-gym
  204. openapi
  205. openapi-dsl
  206. openapi_router
  207. opencage
  208. openstellina
  209. opium >= "0.19.0"
  210. oraft
  211. orun
  212. osh
  213. oui
  214. ozulip
  215. pa_ppx < "0.19"
  216. pandoc
  217. pbrt_yojson
  218. pds-reachability >= "0.2.3"
  219. pgn_parser
  220. phylogenetics >= "0.2.0"
  221. piece_rope
  222. pkcs11 >= "1.0.0"
  223. pkcs11-driver >= "1.0.0"
  224. playwright
  225. polymarket
  226. ppx_deriving_jsonschema
  227. ppx_deriving_yojson
  228. ppx_hegel_test
  229. ppx_protocol_conv_json >= "5.2.1"
  230. ppx_yojson
  231. ppx_yojson_conv_lib
  232. prof_spacetime
  233. pxshot
  234. qdrant
  235. qmp >= "0.19.0"
  236. quests
  237. r2pipe
  238. radare2
  239. rdf
  240. records >= "1.0.0"
  241. repr-bench
  242. rescriptdep
  243. rfsm >= "2.2"
  244. rocq-devtools
  245. rpclib
  246. rungen
  247. SZXX
  248. safemoney
  249. saga
  250. sail < "0.15"
  251. saturn
  252. saturn_lockfree
  253. satyrographos >= "0.0.2.8"
  254. savvy
  255. semver2
  256. serde_json
  257. shakuhachi
  258. sihl < "0.2.0" | >= "0.3.0~rc2"
  259. sihl-core
  260. simple_httpd
  261. slack
  262. slug
  263. smaws-lib
  264. smtml >= "0.7.0"
  265. snf_mcp
  266. sosie
  267. soteria
  268. spectrum_palette_ppx
  269. spotify-web-api
  270. sqlgg >= "20260721"
  271. starred_ml
  272. swagger
  273. talon < "1.0.0~alpha3"
  274. tdigest < "2.1.0"
  275. testcontainers
  276. textmate-language >= "0.3.4"
  277. textrazor >= "0.1.1"
  278. tidy_email_sendgrid
  279. timedesc < "0.8.0"
  280. timedesc-json
  281. timere < "0.4.0"
  282. topup
  283. transom
  284. user-agent-parser
  285. vecosek
  286. vercel
  287. vscoq-language-server < "2.3.3"
  288. vsrocq-language-server
  289. wasm_of_ocaml-compiler
  290. wax
  291. wax-lib
  292. webauthn
  293. why3find
  294. xapi-rrd >= "1.9.0"
  295. yosqlite >= "0.2"
  296. yultracer
  297. zanuda
  298. 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