package yojson

  1. Overview
  2. Docs
Yojson is an optimized parsing and printing library for the JSON format

Install

dune-project
 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

Build Status

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

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

Conflicts

None