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" & < "3.0.1"
  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. github-unix < "4.5.1"
  75. gitlab
  76. goblint >= "2.0.0"
  77. goblint-cil >= "1.8.0"
  78. gopcaml-mode-merlin < "0.0.6"
  79. gradescope_submit
  80. graphql < "0.9.0" | >= "0.14.0"
  81. graphql-async >= "0.14.0"
  82. graphql-cohttp >= "0.13.0"
  83. graphql-lwt >= "0.14.0"
  84. graphql_ppx
  85. gremlin
  86. guardian
  87. h2
  88. hacl_x25519
  89. handlebars-ml
  90. hilite < "0.3.0"
  91. hl_yaml
  92. hockmd
  93. horned_worm
  94. hpack
  95. hsluv
  96. httph
  97. huml
  98. huml-cli
  99. index-bench
  100. ip2location
  101. ip2locationio
  102. irmin-graphql
  103. irmin-tezos
  104. jasmin
  105. jhupllib
  106. jose
  107. js_of_ocaml-compiler < "6.0.1"
  108. jsonrpc < "1.6.0" | >= "1.23.1"
  109. jsonschema
  110. jsonschema2atd
  111. jupyter
  112. jupyter-kernel
  113. jwto
  114. kappa-library
  115. karamel
  116. kaun >= "1.0.0~alpha1"
  117. kind2
  118. kremlin < "transition"
  119. kubecaml
  120. lablgtk3-extras >= "3.0.1"
  121. lambdapi
  122. learn-ocaml
  123. letsencrypt
  124. letters
  125. libsail
  126. lichess_api
  127. linol >= "0.2"
  128. linol-eio
  129. linol-lwt
  130. lockfree >= "0.3.1"
  131. lsp
  132. melange-json = "1.2.0"
  133. melange-json-native
  134. merlin != "4.5-411"
  135. metadb
  136. mirage-crypto-ec
  137. mjson
  138. monorobot
  139. mopsa
  140. morbig >= "0.11.0"
  141. mutaml
  142. nloge
  143. nsq
  144. obuilder
  145. ocaml-lsp-server
  146. ocaml-protoc-plugin >= "6.1.0"
  147. ocaml_db_model
  148. ocaml_pgsql_model
  149. ocf
  150. ocsigen-start
  151. odoc-driver
  152. oframl
  153. oidc
  154. ojs-base
  155. ojs_base
  156. ometrics < "0.2.0"
  157. opam-check-npm-deps >= "4.1.0"
  158. openai-gym
  159. openapi < "1.0.0"
  160. openapi_router
  161. opencage
  162. openstellina
  163. opium >= "0.19.0"
  164. oraft
  165. orun
  166. osh
  167. ozulip
  168. pa_ppx < "0.19"
  169. pandoc
  170. pbrt_yojson
  171. pds-reachability >= "0.2.3"
  172. petr4
  173. pgn_parser
  174. phylogenetics >= "0.2.0"
  175. piece_rope
  176. pkcs11 >= "1.0.0"
  177. pkcs11-driver >= "1.0.0"
  178. polymarket
  179. ppx_deriving_jsonschema
  180. ppx_deriving_yojson
  181. ppx_protocol_conv_json < "5.0.0" | >= "5.2.1"
  182. ppx_yojson
  183. ppx_yojson_conv < "v0.13.0"
  184. ppx_yojson_conv_lib
  185. prof_spacetime
  186. qmp >= "0.19.0"
  187. quests
  188. r2pipe
  189. radare2
  190. rdf < "1.0.0"
  191. records = "0.6.0" | >= "1.0.0"
  192. repr-bench
  193. rfsm >= "2.2"
  194. rocq-devtools
  195. rpclib
  196. rungen
  197. SZXX
  198. safemoney
  199. saga
  200. sail < "0.15"
  201. saturn
  202. saturn_lockfree
  203. satyrographos != "0.0.2.7"
  204. savvy
  205. semver2
  206. sihl < "0.2.0" | >= "0.3.0~rc2"
  207. sihl-core
  208. slack
  209. slug
  210. smaws-lib
  211. smtml >= "0.7.0"
  212. snf_mcp
  213. spotify-web-api
  214. swagger
  215. talon
  216. tdigest < "2.1.0"
  217. textmate-language >= "0.3.4"
  218. textrazor >= "0.1.1"
  219. tezos-context-hash-irmin
  220. tidy_email_sendgrid
  221. timedesc < "0.8.0"
  222. timedesc-json
  223. timere < "0.4.0"
  224. user-agent-parser
  225. vecosek
  226. vercel
  227. vscoq-language-server < "2.3.3"
  228. vsrocq-language-server
  229. webauthn
  230. why3find
  231. xapi-rrd >= "1.9.0"
  232. yojson-bench >= "2.0.2"
  233. zanuda
  234. zarr

Conflicts

None