package yojson

  1. Overview
  2. Docs
Yojson is an optimized parsing and printing library for the JSON format

Install

Dune Dependency

Authors

Maintainers

Sources

yojson-2.1.2.tbz
sha256=59f2f1abbfc8a7ccbdbf608894e5c75e8a76006e34899254446f83e200dfb4f9
sha512=309cba7568dec51de20c7ab8df033258c275b8d58b0a36a66b26e673a3bc050cbd7e39ff8fe4796e89263e125bcc21e04dc36a394f3cc201956887eee1fb281a

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: 27 Nov 2023

README

Yojson: JSON library for OCaml

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

Related tooling

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. abella >= "2.0.8"
  3. acgtk
  4. archetype
  5. atd >= "2.6.0"
  6. atdgen >= "1.13.0" & < "2.8.0" | >= "2.10.0"
  7. atdgen-runtime >= "2.10.0"
  8. avro-compiler
  9. aws-config
  10. aws-s3 < "4.5.1" | >= "4.8.0"
  11. awsm-codegen
  12. bap-radare2
  13. beluga >= "1.1"
  14. bitcoin >= "3.0"
  15. boulangerie
  16. builder-web >= "0.2.0"
  17. caisar
  18. calculon != "0.5"
  19. calculon-redis-lib
  20. calculon-web = "0.6"
  21. camelot >= "1.3.0"
  22. camels
  23. canary
  24. catala = "0.9.0"
  25. cb-check
  26. cbor >= "0.3"
  27. cconv-ppx
  28. colibrics
  29. comby-semantic
  30. commons
  31. containers >= "3.9"
  32. coq-lsp
  33. coq-of-ocaml
  34. coq-serapi >= "8.10.0+0.7.0" & < "8.20.0+0.20.0"
  35. crs >= "0.0.20250705"
  36. current_docker
  37. current_examples
  38. current_git
  39. current_github
  40. current_gitlab
  41. current_slack
  42. current_ssh
  43. current_web
  44. dap
  45. daypack-lib
  46. dblp-api
  47. decoders-yojson >= "0.7.0"
  48. devkit
  49. docfd >= "2.1.0"
  50. docker-api >= "0.2.2"
  51. docker_hub
  52. dot-merlin-reader < "4.9"
  53. dream
  54. dream-inertia
  55. dune-release >= "1.4.0"
  56. dune_deps_extra
  57. eio_main >= "0.10"
  58. elasticsearch-cli = "0.5"
  59. fiat-p256
  60. fit >= "1.2.0"
  61. forester >= "3.1.0"
  62. frama-c < "23.0" | >= "27.0~beta"
  63. fred
  64. frenetic
  65. fstar
  66. gapi-ocaml
  67. gdbprofiler
  68. gemini
  69. gendarme-json
  70. github != "4.0.0"
  71. github-data
  72. gitlab
  73. goblint >= "2.0.0"
  74. goblint-cil >= "1.8.0"
  75. gopcaml-mode-merlin < "0.0.6"
  76. gradescope_submit
  77. graphql < "0.9.0" | >= "0.14.0"
  78. graphql-async >= "0.14.0"
  79. graphql-cohttp >= "0.13.0"
  80. graphql-lwt >= "0.14.0"
  81. graphql_ppx
  82. gremlin
  83. guardian
  84. h2
  85. hacl_x25519
  86. hilite < "0.3.0"
  87. hl_yaml
  88. hockmd
  89. horned_worm
  90. hpack
  91. hsluv
  92. httph
  93. index-bench
  94. ip2location
  95. ip2locationio
  96. irmin-graphql
  97. irmin-tezos
  98. jasmin
  99. jhupllib
  100. jose
  101. js_of_ocaml-compiler
  102. jsonrpc < "1.6.0"
  103. jsonschema
  104. jsonschema2atd
  105. jupyter
  106. jupyter-kernel
  107. jwto
  108. kappa-library
  109. karamel
  110. kind2
  111. kremlin < "transition"
  112. kubecaml
  113. lablgtk3-extras >= "3.0.1"
  114. lambdapi
  115. learn-ocaml
  116. letsencrypt
  117. letters
  118. libsail
  119. linol >= "0.2"
  120. linol-eio
  121. linol-lwt
  122. lockfree >= "0.3.1"
  123. logs-async-reporter >= "1.3"
  124. lsp
  125. melange-json = "1.2.0"
  126. melange-json-native
  127. merlin != "4.5-411"
  128. metadb
  129. mirage-crypto-ec
  130. mjson
  131. monorobot
  132. mopsa
  133. morbig >= "0.11.0"
  134. multicore-bench
  135. mutaml
  136. nloge
  137. nsq
  138. obuilder
  139. ocaml-lsp-server
  140. ocaml-protoc-plugin >= "6.1.0"
  141. ocaml_db_model
  142. ocaml_pgsql_model
  143. ocamleditor >= "1.15.2-ocaml414"
  144. ocf
  145. ocsigen-start
  146. odoc >= "3.0.0"
  147. odoc-driver
  148. oframl
  149. oidc
  150. ojs-base
  151. ojs_base
  152. ometrics < "0.2.0"
  153. openai-gym
  154. openapi
  155. openapi_router
  156. openstellina
  157. opium >= "0.19.0"
  158. oraft
  159. orun
  160. osh
  161. ozulip
  162. pa_ppx < "0.19"
  163. pandoc
  164. pbrt_yojson
  165. pds-reachability >= "0.2.3"
  166. petr4
  167. phylogenetics >= "0.2.0"
  168. piece_rope
  169. pkcs11-driver >= "1.0.0"
  170. ppx_deriving_jsonschema
  171. ppx_deriving_yojson
  172. ppx_protocol_conv_json < "5.0.0" | >= "5.2.1"
  173. ppx_yojson
  174. ppx_yojson_conv < "v0.13.0"
  175. ppx_yojson_conv_lib
  176. prof_spacetime
  177. qmp >= "0.19.0"
  178. quests
  179. r2pipe
  180. radare2
  181. rdf
  182. records = "0.6.0" | >= "1.0.0"
  183. repr-bench
  184. rpclib
  185. rungen
  186. SZXX
  187. safemoney
  188. sail < "0.15"
  189. saturn
  190. saturn_lockfree
  191. satyrographos != "0.0.2.7"
  192. savvy
  193. semver2
  194. serde_json
  195. sihl < "0.2.0" | >= "0.3.0~rc2"
  196. sihl-core
  197. slack
  198. slug
  199. smaws-lib
  200. smtml
  201. snf_mcp
  202. spotify-web-api
  203. starred_ml
  204. swagger
  205. tdigest < "2.1.0"
  206. textmate-language >= "0.3.4"
  207. textrazor >= "0.1.1"
  208. tezos-context-hash-irmin
  209. tidy_email_sendgrid
  210. timedesc < "0.8.0"
  211. timedesc-json
  212. timere < "0.4.0"
  213. user-agent-parser
  214. vecosek
  215. vercel
  216. vscoq-language-server
  217. wasm_of_ocaml-compiler
  218. webauthn
  219. why3find
  220. xapi-rrd >= "1.9.0"
  221. yosqlite >= "0.2"
  222. zanuda
  223. zarr

Conflicts

None

OCaml

Innovation. Community. Security.