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.0.2.tbz
sha256=876bb6f38af73a84a29438a3da35e4857c60a14556a606525b148c6fdbe5461b
sha512=9e150689a814a64e53e361e336fe826df5a3e3851d1367fda4a001392175c29348de55db0b7d7ba18539dec2cf78198efcb7f41b77a9861763f5aa97c05509ad

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: 09 Aug 2022

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 *)

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. dune >= "2.0"
  4. ocaml >= "4.02.3"

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. frama-c >= "19.0"
  59. fred
  60. frenetic >= "3.2.0"
  61. fstar >= "0.9.3.0-beta1"
  62. gapi-ocaml < "0.3.5" | >= "0.4.3"
  63. gdbprofiler >= "0.2"
  64. gemini < "0.3.0"
  65. gen-bs >= "0.1.0"
  66. github != "4.0.0"
  67. github-data
  68. gitlab
  69. goblint >= "2.0.0"
  70. goblint-cil >= "1.8.0"
  71. gopcaml-mode-merlin < "0.0.6"
  72. gradescope_submit
  73. graphql < "0.9.0" | >= "0.14.0"
  74. graphql-async >= "0.14.0"
  75. graphql-cohttp >= "0.13.0"
  76. graphql-lwt >= "0.14.0"
  77. graphql_ppx
  78. gremlin
  79. guardian
  80. h2
  81. hacl_x25519
  82. hilite < "0.3.0"
  83. hl_yaml
  84. hockmd
  85. horned_worm
  86. hpack
  87. hsluv
  88. httph
  89. index-bench
  90. iocaml
  91. iocaml-kernel
  92. ip2location
  93. ip2locationio
  94. irmin-bench < "3.0.0"
  95. irmin-graphql >= "2.2.0"
  96. irmin-tezos
  97. jasmin
  98. jhupllib
  99. jose
  100. js_of_ocaml-compiler
  101. json-pointer
  102. json-predicate
  103. jsonrpc < "1.6.0"
  104. jsonschema2atd
  105. jupyter
  106. jupyter-kernel
  107. jwto
  108. kappa-library
  109. karamel
  110. ketrew
  111. kind2
  112. kremlin < "transition"
  113. kubecaml
  114. lablgtk3-extras >= "3.0.1"
  115. lablqt
  116. lambdapi >= "2.0.0"
  117. learn-ocaml
  118. letsencrypt
  119. letters
  120. libsail
  121. linol >= "0.2"
  122. linol-lwt
  123. lockfree >= "0.3.0"
  124. lsp
  125. merlin = "3.0.3" | = "3.8.0" | >= "4.6-412"
  126. merlin-acme
  127. metadb
  128. mezzo
  129. minimal >= "1.1.0"
  130. mirage-crypto-ec
  131. mjson
  132. monorobot
  133. morbig >= "0.11.0"
  134. netml
  135. nloge
  136. nsq >= "0.2.4"
  137. obuilder
  138. ocaml-gist
  139. ocaml-lsp-server
  140. ocaml-webworker
  141. ocaml_db_model
  142. ocaml_pgsql_model
  143. ocf
  144. oclaunch < "0.2.1"
  145. ocsigen-start
  146. odoc >= "2.0.0" & < "2.1.1" | >= "2.3.0"
  147. oframl
  148. ogen = "0.1.2"
  149. oidc
  150. ojs-base != "0.2.0"
  151. ojs_base
  152. ometrics < "0.2.0"
  153. opam2web >= "2.0"
  154. openai-gym
  155. openapi
  156. openapi_router
  157. openstellina
  158. opium >= "0.19.0"
  159. oraft
  160. orun
  161. osh
  162. ozulip
  163. pa_ppx
  164. pandoc
  165. pbrt_yojson
  166. pds-reachability >= "0.2.3"
  167. petr4
  168. phylogenetics >= "0.2.0"
  169. piece_rope
  170. pkcs11-driver >= "1.0.0"
  171. plist >= "1.0.0"
  172. podge >= "0.4"
  173. ppx_deriving_protocol < "0.8.1"
  174. ppx_deriving_yojson >= "3.4"
  175. ppx_graphql
  176. ppx_json_types
  177. ppx_protocol_conv = "2.0.0"
  178. ppx_protocol_conv_json = "3.1.3" | >= "5.2.1"
  179. ppx_yojson
  180. ppx_yojson_conv < "v0.13.0"
  181. ppx_yojson_conv_lib
  182. prof_spacetime
  183. qmp >= "0.19.0"
  184. quests
  185. r2pipe
  186. radare2
  187. rdf >= "0.9.0" & < "1.0.0"
  188. records = "0.6.0" | >= "1.0.0"
  189. repr-bench
  190. rpc = "2.2.0"
  191. rpclib >= "6.0.0"
  192. rubytt
  193. rungen
  194. SZXX
  195. safemoney
  196. sail < "0.15"
  197. saturn
  198. saturn_lockfree
  199. satyrographos != "0.0.2.7"
  200. semver2
  201. sihl < "0.2.0" | >= "0.3.0~rc2"
  202. sihl-core
  203. slack
  204. slacko < "0.14.1"
  205. slug
  206. sparrow
  207. sphinxcontrib-ocaml
  208. spotify-web-api
  209. swagger
  210. tdigest < "2.1.0"
  211. telegraml < "2.2.0"
  212. testrunner
  213. textmate-language >= "0.3.4"
  214. textrazor >= "0.1.1"
  215. tezos-context-hash-irmin
  216. themoviedb
  217. tidy_email_sendgrid
  218. timedesc < "0.8.0"
  219. timedesc-json
  220. timere < "0.4.0"
  221. transmission-rpc
  222. u2f
  223. usbmux
  224. user-agent-parser
  225. vecosek
  226. vercel
  227. vscoq-language-server
  228. webauthn
  229. xapi-rrd >= "1.9.0"
  230. yojson-bench >= "2.0.2"
  231. zanuda

Conflicts

None