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.1.0.tbz
sha256=9fcb1ff2db58ab259f9228796b0ada4794eae97177b1833371380c4e4f90b15d
sha512=31ab8580e0e4e8a05459fbec2fb9424a3df4cf5aef6df21fc577dbe3d32e81103a632c6a511c4dcf1f51819e88b38d2ce7d6888545bc3f359e69e070f8d2e69c

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

  1. seq >= "0.2.2"
  2. cppo build
  3. ocaml >= "4.02.3"
  4. dune >= "2.7"

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

Conflicts

None