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

Conflicts

None