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.2.2.tbz
sha256=9abfad8c9a79d4723ad2f6448e669c1e68dbfc87cc54a1b7c064b0c90912c595
sha512=ac52eae3ca1d3129a7885ca638e6ae5bcfc387598a82cc30d3e4988fd154f1756719c399f96e950d898c79a6dbd4ccc44b6f468bcafbd620e6945a0415b41e0c

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.

Published: 29 Jun 2024

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

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

Conflicts

None