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-2.0.2.tbz
sha256=876bb6f38af73a84a29438a3da35e4857c60a14556a606525b148c6fdbe5461b
sha512=9e150689a814a64e53e361e336fe826df5a3e3851d1367fda4a001392175c29348de55db0b7d7ba18539dec2cf78198efcb7f41b77a9861763f5aa97c05509ad

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 *)

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. dune >= "2.0"
  4. ocaml >= "4.02.3"

Dev Dependencies (2)

  1. odoc with-doc
  2. alcotest with-test & >= "0.8.5"

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

Conflicts

None