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.0.tbz
sha256=ab5d863f7f951a8f7fb4a708399ca2da2cf139a5e0af7818145c20295420cb1a
sha512=3ea982dbeef7ec8da54d29124ddb8b86f90583eb96ed3947851cedec9e3d2d47b981e3465d41f2c94943e6865ba6a9a51c6f0252efa6df2386d398b679aae8f2

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 Jun 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
  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
  3. archetype
  4. atd >= "2.6.0"
  5. atdgen >= "1.13.0" & < "2.8.0"
  6. avro-compiler
  7. aws-config
  8. aws-s3 < "4.5.1" | >= "4.8.0"
  9. awsm-codegen
  10. bap-radare2
  11. bitcoin >= "3.0"
  12. boulangerie
  13. builder-web >= "0.2.0"
  14. caisar
  15. calculon != "0.5"
  16. calculon-redis-lib
  17. calculon-web = "0.6"
  18. camelot >= "1.3.0"
  19. camels
  20. canary
  21. catala = "0.9.0"
  22. cb-check
  23. cbor >= "0.3"
  24. cconv-ppx
  25. colibrics
  26. comby-semantic
  27. commons
  28. containers >= "3.9"
  29. coq-lsp
  30. coq-of-ocaml
  31. coq-serapi >= "8.10.0+0.7.0" & < "8.20.0+0.20.0"
  32. current_docker
  33. current_examples
  34. current_git
  35. current_github
  36. current_gitlab
  37. current_slack
  38. current_ssh
  39. current_web
  40. dap
  41. daypack-lib
  42. dblp-api
  43. decoders-yojson >= "0.7.0"
  44. devkit
  45. docker-api >= "0.2.2"
  46. docker_hub
  47. dot-merlin-reader < "4.9"
  48. dream
  49. dream-inertia
  50. dune-release >= "1.4.0"
  51. dune_deps_extra
  52. elasticsearch-cli = "0.5"
  53. fiat-p256
  54. frama-c
  55. fred
  56. frenetic
  57. fstar
  58. gapi-ocaml
  59. gdbprofiler
  60. gemini < "0.3.0"
  61. gendarme-json
  62. github != "4.0.0"
  63. github-data
  64. gitlab
  65. goblint >= "2.0.0"
  66. goblint-cil >= "1.8.0"
  67. gopcaml-mode-merlin < "0.0.6"
  68. graphql < "0.9.0" | >= "0.14.0"
  69. graphql-async >= "0.14.0"
  70. graphql-cohttp >= "0.13.0"
  71. graphql-lwt >= "0.14.0"
  72. graphql_ppx
  73. gremlin
  74. h2
  75. hacl_x25519
  76. hilite < "0.3.0"
  77. hl_yaml
  78. hockmd
  79. horned_worm
  80. hpack
  81. hsluv
  82. httph
  83. index-bench
  84. ip2location
  85. ip2locationio
  86. irmin-graphql
  87. irmin-tezos
  88. jasmin
  89. jhupllib
  90. jose
  91. js_of_ocaml-compiler < "6.0.1"
  92. jsonrpc < "1.6.0"
  93. jsonschema
  94. jsonschema2atd
  95. jupyter
  96. jupyter-kernel
  97. jwto
  98. kappa-library
  99. karamel
  100. kind2
  101. kremlin < "transition"
  102. kubecaml
  103. lablgtk3-extras >= "3.0.1"
  104. lambdapi
  105. learn-ocaml
  106. letsencrypt
  107. letters
  108. libsail
  109. linol >= "0.2"
  110. linol-eio
  111. linol-lwt
  112. lsp
  113. melange-json = "1.2.0"
  114. melange-json-native
  115. merlin != "4.5-411"
  116. metadb
  117. mirage-crypto-ec
  118. mjson
  119. monorobot
  120. mopsa
  121. morbig >= "0.11.0"
  122. mutaml
  123. nloge
  124. nsq
  125. obuilder
  126. ocaml-lsp-server
  127. ocaml-protoc-plugin >= "6.1.0"
  128. ocaml_db_model
  129. ocaml_pgsql_model
  130. ocf
  131. ocsigen-start
  132. odoc-driver
  133. oframl
  134. oidc
  135. ojs-base
  136. ojs_base
  137. ometrics < "0.2.0"
  138. openai-gym
  139. openapi < "1.0.0"
  140. openapi_router
  141. openstellina
  142. opium >= "0.19.0"
  143. oraft
  144. orun
  145. osh
  146. ozulip
  147. pa_ppx < "0.19"
  148. pandoc
  149. pbrt_yojson
  150. pds-reachability >= "0.2.3"
  151. petr4
  152. phylogenetics >= "0.2.0"
  153. pkcs11-driver >= "1.0.0"
  154. ppx_deriving_jsonschema
  155. ppx_deriving_yojson
  156. ppx_protocol_conv_json < "5.0.0" | >= "5.2.1"
  157. ppx_yojson
  158. ppx_yojson_conv < "v0.13.0"
  159. ppx_yojson_conv_lib
  160. prof_spacetime
  161. qmp >= "0.19.0"
  162. quests
  163. r2pipe
  164. radare2
  165. rdf < "1.0.0"
  166. records = "0.6.0" | >= "1.0.0"
  167. repr-bench
  168. rpclib
  169. rungen
  170. SZXX
  171. safemoney
  172. sail < "0.15"
  173. satyrographos != "0.0.2.7"
  174. savvy
  175. semver2
  176. sihl < "0.2.0" | >= "0.3.0~rc2"
  177. sihl-core
  178. slack
  179. slug
  180. smaws-lib
  181. smtml
  182. snf_mcp
  183. spotify-web-api
  184. swagger
  185. tdigest < "2.1.0"
  186. textmate-language >= "0.3.4"
  187. textrazor >= "0.1.1"
  188. tezos-context-hash-irmin
  189. tidy_email_sendgrid
  190. timedesc < "0.8.0"
  191. timedesc-json
  192. timere < "0.4.0"
  193. user-agent-parser
  194. vecosek
  195. vercel
  196. vscoq-language-server
  197. webauthn
  198. why3find
  199. xapi-rrd >= "1.9.0"
  200. yojson-bench < "2.0.1"
  201. zanuda
  202. zarr

Conflicts

None

OCaml

Innovation. Community. Security.