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

Conflicts

None