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

Conflicts

None

OCaml

Innovation. Community. Security.