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.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

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 *)

let () = 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. 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
  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. atdml
  9. avro-compiler
  10. avro-simple
  11. aws-config
  12. aws-s3 < "4.5.1" | >= "4.8.0"
  13. awsm-codegen
  14. bap-radare2
  15. beluga >= "1.1"
  16. bitcoin >= "3.0"
  17. bizowie-api
  18. boulangerie
  19. builder-web >= "0.2.0"
  20. caisar
  21. calculon
  22. camelot >= "1.4.2"
  23. camels
  24. canary
  25. catala = "0.9.0" | >= "1.0.0~beta"
  26. cb-check
  27. cbor >= "0.3"
  28. chess_com_api
  29. colibrics
  30. comby-semantic
  31. commons
  32. containers >= "3.9"
  33. coq-lsp
  34. coq-of-ocaml
  35. coq-serapi < "8.20.0+0.20.0"
  36. current_docker
  37. current_examples
  38. current_git
  39. current_github
  40. current_gitlab
  41. current_slack
  42. current_ssh
  43. current_web
  44. dap
  45. daypack-lib
  46. dblp-api
  47. decoders-yojson >= "0.7.0"
  48. devkit
  49. dnsrobot
  50. docker-api >= "0.2.2"
  51. docker_hub
  52. dot-merlin-reader < "4.9"
  53. dream
  54. dream-inertia
  55. dune-release >= "1.4.0"
  56. dune_deps_extra
  57. eio_main >= "0.10"
  58. elasticsearch-cli = "0.5"
  59. elpi >= "3.3.1"
  60. fehu < "1.0.0~alpha3"
  61. fiat-p256
  62. fit >= "1.2.0"
  63. frama-c < "23.0" | >= "27.0~beta"
  64. fred
  65. frenetic
  66. fstar
  67. gapi-ocaml
  68. gdbprofiler
  69. gemini
  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. 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
  107. jsonrpc < "1.6.0" | >= "1.23.1"
  108. jsonschema
  109. jsonschema-core
  110. jsonschema2atd
  111. jupyter
  112. jupyter-kernel
  113. jwto
  114. kappa-agents >= "4.1.3"
  115. kappa-binaries >= "4.1.3"
  116. kappa-library
  117. karamel
  118. kaun >= "1.0.0~alpha1" & < "1.0.0~alpha3"
  119. kind2
  120. kremlin < "transition"
  121. kubecaml
  122. lablgtk3-extras >= "3.0.1"
  123. lambdapi
  124. learn-ocaml
  125. letsencrypt < "2.0.0"
  126. letters
  127. libsail
  128. lichess_api
  129. linol >= "0.2"
  130. linol-eio
  131. linol-lwt
  132. lockfree >= "0.3.1"
  133. logs-async-reporter >= "1.3"
  134. lsp
  135. melange-json = "1.2.0"
  136. melange-json-native
  137. merlin != "4.5-411"
  138. metadb
  139. miaou-core
  140. miaou-driver-web
  141. mirage-crypto-ec
  142. mjson
  143. monorobot
  144. mopsa
  145. morbig >= "0.11.0"
  146. multicore-bench
  147. mutaml
  148. nats-client
  149. nats-client-async
  150. neo4j_bolt
  151. nloge
  152. nsq
  153. obuilder
  154. ocaml-lsp-server
  155. ocaml-protoc-plugin >= "6.1.0"
  156. ocaml_db_model
  157. ocaml_pgsql_model
  158. ocamleditor
  159. ocf
  160. ochre
  161. ocsigen-start
  162. odoc >= "3.0.0"
  163. odoc-driver
  164. oframl
  165. oidc
  166. ojs-base
  167. ojs_base
  168. ometrics < "0.2.0"
  169. opam-check-npm-deps >= "4.1.0"
  170. openai-gym
  171. openapi < "1.0.0"
  172. openapi_router
  173. opencage
  174. openstellina
  175. opium >= "0.19.0"
  176. oraft
  177. orun
  178. osh
  179. oui
  180. ozulip
  181. pa_ppx < "0.19"
  182. pandoc
  183. pbrt_yojson
  184. pds-reachability >= "0.2.3"
  185. pgn_parser
  186. phylogenetics >= "0.2.0"
  187. piece_rope
  188. pkcs11 >= "1.0.0"
  189. pkcs11-driver >= "1.0.0"
  190. polymarket
  191. ppx_deriving_jsonschema
  192. ppx_deriving_yojson
  193. ppx_protocol_conv_json >= "5.2.1"
  194. ppx_yojson
  195. ppx_yojson_conv_lib
  196. prof_spacetime
  197. pxshot
  198. qdrant
  199. qmp >= "0.19.0"
  200. quests
  201. r2pipe
  202. radare2
  203. rdf < "1.0.0"
  204. records >= "1.0.0"
  205. repr-bench
  206. rescriptdep
  207. rfsm >= "2.2"
  208. rocq-devtools
  209. rpclib
  210. rungen
  211. SZXX
  212. safemoney
  213. saga
  214. sail < "0.15"
  215. saturn
  216. saturn_lockfree
  217. satyrographos >= "0.0.2.8"
  218. savvy
  219. semver2
  220. serde_json
  221. shakuhachi
  222. sihl < "0.2.0" | >= "0.3.0~rc2"
  223. sihl-core
  224. simple_httpd
  225. slack
  226. slug
  227. smaws-lib
  228. smtml >= "0.7.0"
  229. snf_mcp
  230. spectrum_palette_ppx
  231. spotify-web-api
  232. swagger
  233. talon < "1.0.0~alpha3"
  234. tdigest < "2.1.0"
  235. testcontainers
  236. textmate-language >= "0.3.4"
  237. textrazor >= "0.1.1"
  238. tidy_email_sendgrid
  239. timedesc < "0.8.0"
  240. timedesc-json
  241. timere < "0.4.0"
  242. user-agent-parser
  243. vecosek
  244. vercel
  245. vscoq-language-server < "2.3.3"
  246. vsrocq-language-server
  247. wasm_of_ocaml-compiler
  248. webauthn
  249. why3find
  250. xapi-rrd >= "1.9.0"
  251. yultracer
  252. zanuda
  253. zarr

Conflicts

None