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.2.tbz
sha256=59f2f1abbfc8a7ccbdbf608894e5c75e8a76006e34899254446f83e200dfb4f9
sha512=309cba7568dec51de20c7ab8df033258c275b8d58b0a36a66b26e673a3bc050cbd7e39ff8fe4796e89263e125bcc21e04dc36a394f3cc201956887eee1fb281a

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

Conflicts

None