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-3.0.0.tbz
sha256=99414da7609b92a02474ef4b49ecda15edc8cbba5229341b124e7e4695c39610
sha512=896d0ea829a36ccadba6628800369c1a3ab9e7c64dbda8b76331889c9db481cd64e137f467481ae80a8dd5fca45d748bfa71f58641806cc1bb1a007f8291789f

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

  1. ocaml >= "4.08"
  2. 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 >= "3.0.1"
  8. atdgen-runtime >= "2.10.0"
  9. atdml
  10. avro-compiler
  11. avro-simple
  12. aws-config
  13. aws-eio
  14. aws-s3 < "4.5.1" | >= "4.8.0"
  15. awskit-lwt-unix
  16. awskit-s3
  17. awsm-codegen
  18. awso
  19. awso-common
  20. bap-radare2
  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" & < "1.2.0"
  33. cbor >= "0.3"
  34. cdp
  35. cdp-gen
  36. chess_com_api
  37. colibrics
  38. comby-semantic
  39. commons
  40. containers >= "3.9"
  41. contract
  42. coq-lsp
  43. coq-of-ocaml
  44. coq-serapi < "8.20.0+0.20.0"
  45. crs >= "0.0.20250705"
  46. current_docker
  47. current_examples
  48. current_git
  49. current_github
  50. current_gitlab
  51. current_slack
  52. current_ssh
  53. current_web
  54. dap
  55. daypack-lib
  56. dblp-api
  57. decoders-yojson >= "0.7.0"
  58. devkit
  59. dnsrobot
  60. docker-api >= "0.2.2"
  61. docker_hub
  62. dot-merlin-reader < "4.9"
  63. dream
  64. dream-inertia
  65. dune-cargo-build
  66. dune-release >= "1.4.0"
  67. dune_deps_extra
  68. ecma-regex
  69. eio_main >= "0.10"
  70. elasticsearch-cli = "0.5"
  71. elpi >= "3.3.1"
  72. fehu < "1.0.0~alpha3"
  73. fiat-p256
  74. fit >= "1.2.0"
  75. forester >= "3.1.0"
  76. frama-c < "23.0" | >= "27.0~beta"
  77. fred
  78. frenetic
  79. fstar
  80. fxmacrodata
  81. gapi-ocaml
  82. gdbprofiler
  83. gemini
  84. gendarme-json < "0.4.0"
  85. gendarme-yojson
  86. github != "4.0.0"
  87. github-data
  88. github-unix >= "4.5.1"
  89. gitlab
  90. gmocoin
  91. goblint-cil >= "1.8.0"
  92. gopcaml-mode-merlin < "0.0.6"
  93. grace >= "0.4.0"
  94. gradescope_submit
  95. graphql < "0.9.0" | >= "0.14.0"
  96. graphql-async >= "0.14.0"
  97. graphql-cohttp >= "0.13.0"
  98. graphql-lwt >= "0.14.0"
  99. graphql_ppx
  100. gremlin
  101. guardian
  102. h2
  103. hacl_x25519
  104. handlebars-ml
  105. hegel
  106. hilite < "0.3.0"
  107. hockmd
  108. hpack
  109. hpke
  110. hsluv
  111. httph
  112. huml
  113. huml-cli
  114. index-bench
  115. ip2location
  116. ip2locationio
  117. ip2whois
  118. irmin-graphql
  119. irmin-tezos
  120. jasmin
  121. jhupllib
  122. jose
  123. js_of_ocaml-compiler
  124. jsonkit
  125. jsonrpc >= "1.23.1"
  126. jsonschema
  127. jsonschema-core
  128. jsonschema2atd
  129. jupyter
  130. jupyter-kernel
  131. jwto
  132. kappa-library < "4.1.3"
  133. karamel
  134. kaun >= "1.0.0~alpha1" & < "1.0.0~alpha3"
  135. kind2 >= "3.0.0"
  136. kremlin < "transition"
  137. kubecaml
  138. lablgtk3-extras >= "3.0.1"
  139. lambdapi
  140. landmarks-speedscope
  141. learn-ocaml
  142. letsencrypt < "2.0.0"
  143. letters
  144. libsail
  145. lichess_api
  146. linol >= "0.2" & < "0.10"
  147. linol-eio
  148. linol-lwt
  149. lockfree >= "0.3.1"
  150. logs-async-reporter >= "1.3"
  151. lsp < "1.6.0" | >= "1.23.1"
  152. melange-edn >= "0.5.0"
  153. melange-json = "1.2.0"
  154. melange-json-native
  155. merlin != "4.5-411"
  156. metadb
  157. miaou-core
  158. miaou-driver-web
  159. mirage-crypto-ec
  160. mjson
  161. monorobot
  162. mopsa
  163. multicore-bench
  164. mutaml
  165. nats-client
  166. nats-client-async
  167. neo4j_bolt
  168. nloge
  169. noise
  170. nsq
  171. obuilder
  172. ocaml-ai-sdk
  173. ocaml-lsp-server < "1.10.5" | >= "1.18.0" & != "1.21.0-4.14" & != "1.23.0"
  174. ocaml-protoc-plugin >= "6.1.0"
  175. ocaml_db_model
  176. ocaml_pgsql_model
  177. ocamleditor
  178. ocamlgrep-lib
  179. ocf >= "1.0.0"
  180. ochre
  181. ocsigen-start
  182. odoc >= "3.0.0"
  183. odoc-driver
  184. oframl
  185. oidc
  186. ojs-base
  187. ojs_base
  188. ometrics < "0.2.0"
  189. opam-check-npm-deps >= "4.1.0"
  190. openai-gym
  191. openapi
  192. openapi_router
  193. opencage
  194. openstellina
  195. opium >= "0.19.0"
  196. oraft
  197. orun
  198. osh
  199. oui
  200. oxbow
  201. ozulip
  202. pa_ppx < "0.14" | >= "0.19"
  203. pandoc
  204. pbrt_yojson
  205. pds-reachability >= "0.2.3"
  206. pgn_parser
  207. pgn_to_tex
  208. phylogenetics >= "0.2.0"
  209. piece_rope
  210. pkcs11-driver >= "1.0.0"
  211. playwright
  212. polymarket
  213. ppx_deriving_jsonschema
  214. ppx_deriving_yojson < "3.6.1"
  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. query-json
  225. quests
  226. r2pipe
  227. radare2
  228. rdf
  229. records >= "1.0.0"
  230. repr-bench
  231. rescriptdep
  232. rfsm >= "2.2"
  233. rocq-devtools
  234. rpclib
  235. rungen
  236. rust-staticlib-gen
  237. SZXX
  238. safemoney
  239. saga
  240. sail < "0.15"
  241. saturn
  242. saturn_lockfree
  243. satyrographos >= "0.0.2.8" & < "0.0.2.13"
  244. savvy
  245. semver2
  246. serde_json
  247. server-reason-react >= "0.4.0"
  248. shakuhachi
  249. sihl < "0.2.0" | >= "0.3.0~rc2"
  250. sihl-core
  251. simple_httpd
  252. slack
  253. slug
  254. smaws-lib
  255. smtml >= "0.7.0"
  256. snf_mcp < "0.2.1"
  257. sosie
  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 >= "3.0.0"
  286. yosqlite >= "0.2"
  287. yultracer
  288. zanuda
  289. zarr

Conflicts

None