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. builder-web >= "0.2.0"
  17. caisar
  18. calculon != "0.5"
  19. calculon-redis-lib
  20. camelot >= "1.3.0"
  21. camels
  22. canary
  23. catala = "0.9.0"
  24. cb-check
  25. cbor != "0.2"
  26. cconv-ppx
  27. colibrics
  28. comby-semantic
  29. commons
  30. containers >= "3.9"
  31. coq-lsp
  32. coq-of-ocaml
  33. coq-serapi >= "8.10.0+0.7.0" & < "8.20.0+0.20.0"
  34. current_docker
  35. current_examples >= "0.4"
  36. current_git
  37. current_github
  38. current_gitlab
  39. current_slack
  40. current_ssh
  41. current_web >= "0.4"
  42. cwe_checker
  43. dap
  44. datakit-ci >= "0.12.3"
  45. daypack-lib
  46. dblp-api
  47. decoders-yojson >= "0.7.0"
  48. deriving-yojson
  49. devkit >= "0.4"
  50. docfd >= "2.1.0"
  51. docker-api >= "0.2.2"
  52. docker_hub
  53. dot-merlin-reader != "4.4~5.0.preview" & < "4.6"
  54. dream
  55. dune-release >= "1.4.0"
  56. earlybird < "1.0.0"
  57. eio_main >= "0.10"
  58. facebook-sdk < "0.3.1"
  59. fiat-p256
  60. frama-c >= "19.0"
  61. fred
  62. frenetic >= "3.2.0"
  63. fstar >= "0.9.3.0-beta1"
  64. gapi-ocaml < "0.3.5" | >= "0.4.3"
  65. gdbprofiler >= "0.2"
  66. gemini < "0.3.0"
  67. gen-bs >= "0.1.0"
  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. iocaml
  93. iocaml-kernel
  94. ip2location
  95. ip2locationio
  96. irmin-bench < "3.0.0"
  97. irmin-graphql >= "2.2.0"
  98. irmin-tezos
  99. jasmin
  100. jhupllib
  101. jose
  102. js_of_ocaml-compiler
  103. json-pointer
  104. json-predicate
  105. jsonrpc < "1.6.0"
  106. jsonschema2atd
  107. jupyter
  108. jupyter-kernel
  109. jwto
  110. kappa-library
  111. karamel
  112. ketrew
  113. kind2
  114. kremlin < "transition"
  115. kubecaml
  116. lablgtk3-extras >= "3.0.1"
  117. lablqt
  118. lambdapi >= "2.0.0"
  119. learn-ocaml
  120. letsencrypt
  121. letters
  122. libsail
  123. linol >= "0.2"
  124. linol-eio
  125. linol-lwt
  126. lockfree >= "0.3.0"
  127. lsp
  128. melange-json = "1.2.0"
  129. melange-json-native
  130. merlin = "3.0.3" | = "3.8.0" | >= "4.6-412"
  131. merlin-acme
  132. metadb
  133. mezzo
  134. minimal >= "1.1.0"
  135. mirage-crypto-ec
  136. mjson
  137. monorobot
  138. mopsa
  139. morbig >= "0.11.0"
  140. mutaml >= "0.2"
  141. netml
  142. nloge
  143. nsq >= "0.2.4"
  144. obuilder
  145. ocaml-gist
  146. ocaml-lsp-server
  147. ocaml-protoc-plugin >= "6.1.0"
  148. ocaml-webworker
  149. ocaml_db_model
  150. ocaml_pgsql_model
  151. ocf
  152. oclaunch < "0.2.1"
  153. ocsigen-start
  154. odoc >= "2.0.0" & < "2.1.1" | >= "2.3.0"
  155. oframl
  156. ogen = "0.1.2"
  157. oidc
  158. ojs-base != "0.2.0"
  159. ojs_base
  160. ometrics < "0.2.0"
  161. opam2web >= "2.0"
  162. openai-gym
  163. openapi < "1.0.0"
  164. openapi_router
  165. openstellina
  166. opium >= "0.19.0"
  167. oraft
  168. orun
  169. osh
  170. ozulip
  171. pa_ppx
  172. pandoc
  173. pbrt_yojson
  174. pds-reachability >= "0.2.3"
  175. petr4
  176. phylogenetics >= "0.2.0"
  177. piece_rope
  178. pkcs11-driver >= "1.0.0"
  179. plist >= "1.0.0"
  180. podge >= "0.4"
  181. ppx_deriving_jsonschema
  182. ppx_deriving_protocol < "0.8.1"
  183. ppx_deriving_yojson >= "3.4"
  184. ppx_graphql
  185. ppx_json_types
  186. ppx_protocol_conv = "2.0.0"
  187. ppx_protocol_conv_json = "3.1.3" | >= "5.2.1"
  188. ppx_yojson
  189. ppx_yojson_conv < "v0.13.0"
  190. ppx_yojson_conv_lib
  191. prof_spacetime
  192. qmp >= "0.19.0"
  193. quests
  194. r2pipe
  195. radare2
  196. rdf >= "0.9.0" & < "1.0.0"
  197. records = "0.6.0" | >= "1.0.0"
  198. repr-bench
  199. rpc = "2.2.0"
  200. rpclib >= "6.0.0"
  201. rubytt
  202. rungen
  203. SZXX
  204. safemoney
  205. sail < "0.15"
  206. saturn
  207. saturn_lockfree
  208. satyrographos != "0.0.2.7"
  209. semver2
  210. sihl < "0.2.0" | >= "0.3.0~rc2"
  211. sihl-core
  212. slack
  213. slacko < "0.14.1"
  214. slug
  215. smtml >= "0.2.2"
  216. sparrow
  217. sphinxcontrib-ocaml
  218. spotify-web-api
  219. swagger
  220. tdigest < "2.1.0"
  221. telegraml < "2.2.0"
  222. testrunner
  223. textmate-language >= "0.3.4"
  224. textrazor >= "0.1.1"
  225. tezos-context-hash-irmin
  226. themoviedb
  227. tidy_email_sendgrid
  228. timedesc < "0.8.0"
  229. timedesc-json
  230. timere < "0.4.0"
  231. transmission-rpc
  232. u2f
  233. usbmux
  234. user-agent-parser
  235. vecosek
  236. vercel
  237. vscoq-language-server
  238. webauthn
  239. why3find
  240. xapi-rrd >= "1.9.0"
  241. yojson-bench >= "2.0.2"
  242. zanuda
  243. zarr

Conflicts

None

OCaml

Innovation. Community. Security.