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

Conflicts

None