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.1.tbz
sha256=8bc8bc722a4a94656a58394f17f9f8a406267343ab87d77202db930584a0c836
sha512=93ebabd3247f1b5826827472229188c5ac1b4d2395eb8121a22b35acd773eedd290e6b8de1f067020fc868da7c05a60408091eebc0b305a67408d558a3a94c10

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

Conflicts

None