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.1.tbz
sha256=d58183207b198dc065866239066e074c34f9e139c0d9c4175a38809790e88173
sha512=f7b8529900acb29bc6236d8312d3ebcadbcb3f9d361c8acaed9f7fc7e30527b41a1f3cff80382dde445e6da18a4edc5a9c6758af24affce1022d0741dbd9daeb

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

Conflicts

None

OCaml

Innovation. Community. Security.