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.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.

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

Conflicts

None