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

Conflicts

None