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. ecma-regex
  58. eio_main >= "0.10"
  59. elasticsearch-cli = "0.5"
  60. elpi >= "3.3.1"
  61. fehu < "1.0.0~alpha3"
  62. fiat-p256
  63. fit >= "1.2.0"
  64. frama-c < "23.0" | >= "27.0~beta"
  65. fred
  66. frenetic
  67. fstar
  68. gapi-ocaml
  69. gdbprofiler
  70. gemini
  71. gendarme-json < "0.4.0"
  72. gendarme-yojson
  73. github != "4.0.0"
  74. github-data
  75. github-unix < "4.5.1"
  76. gitlab
  77. goblint >= "2.0.0"
  78. goblint-cil >= "1.8.0"
  79. gopcaml-mode-merlin < "0.0.6"
  80. gradescope_submit
  81. graphql < "0.9.0" | >= "0.14.0"
  82. graphql-async >= "0.14.0"
  83. graphql-cohttp >= "0.13.0"
  84. graphql-lwt >= "0.14.0"
  85. graphql_ppx
  86. gremlin
  87. guardian
  88. h2
  89. hacl_x25519
  90. handlebars-ml
  91. hilite < "0.3.0"
  92. hl_yaml
  93. hockmd
  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
  108. jsonrpc < "1.6.0" | >= "1.23.1"
  109. jsonschema
  110. jsonschema-core
  111. jsonschema2atd
  112. jupyter
  113. jupyter-kernel
  114. jwto
  115. kappa-agents >= "4.1.3"
  116. kappa-binaries >= "4.1.3"
  117. kappa-library
  118. karamel
  119. kaun >= "1.0.0~alpha1" & < "1.0.0~alpha3"
  120. kind2
  121. kremlin < "transition"
  122. kubecaml
  123. lablgtk3-extras >= "3.0.1"
  124. lambdapi
  125. learn-ocaml
  126. letsencrypt < "2.0.0"
  127. letters
  128. libsail
  129. lichess_api
  130. linol >= "0.2"
  131. linol-eio
  132. linol-lwt
  133. lockfree >= "0.3.1"
  134. logs-async-reporter >= "1.3"
  135. lsp
  136. melange-json = "1.2.0"
  137. melange-json-native
  138. merlin != "4.5-411"
  139. metadb
  140. miaou-core
  141. miaou-driver-web
  142. mirage-crypto-ec
  143. mjson
  144. monorobot
  145. mopsa
  146. morbig >= "0.11.0"
  147. multicore-bench
  148. mutaml
  149. nats-client
  150. nats-client-async
  151. neo4j_bolt
  152. nloge
  153. nsq
  154. obuilder
  155. ocaml-lsp-server
  156. ocaml-protoc-plugin >= "6.1.0"
  157. ocaml_db_model
  158. ocaml_pgsql_model
  159. ocamleditor
  160. ocf
  161. ochre
  162. ocsigen-start
  163. odoc >= "3.0.0"
  164. odoc-driver
  165. oframl
  166. oidc
  167. ojs-base
  168. ojs_base
  169. ometrics < "0.2.0"
  170. opam-check-npm-deps >= "4.1.0"
  171. openai-gym
  172. openapi < "1.0.0"
  173. openapi_router
  174. opencage
  175. openstellina
  176. opium >= "0.19.0"
  177. oraft
  178. orun
  179. osh
  180. oui
  181. ozulip
  182. pa_ppx < "0.19"
  183. pandoc
  184. pbrt_yojson
  185. pds-reachability >= "0.2.3"
  186. pgn_parser
  187. phylogenetics >= "0.2.0"
  188. piece_rope
  189. pkcs11 >= "1.0.0"
  190. pkcs11-driver >= "1.0.0"
  191. polymarket
  192. ppx_deriving_jsonschema
  193. ppx_deriving_yojson
  194. ppx_protocol_conv_json >= "5.2.1"
  195. ppx_yojson
  196. ppx_yojson_conv_lib
  197. prof_spacetime
  198. pxshot
  199. qdrant
  200. qmp >= "0.19.0"
  201. quests
  202. r2pipe
  203. radare2
  204. rdf < "1.0.0"
  205. records >= "1.0.0"
  206. repr-bench
  207. rescriptdep
  208. rfsm >= "2.2"
  209. rocq-devtools
  210. rpclib
  211. rungen
  212. SZXX
  213. safemoney
  214. saga
  215. sail < "0.15"
  216. saturn
  217. saturn_lockfree
  218. satyrographos >= "0.0.2.8"
  219. savvy
  220. semver2
  221. serde_json
  222. shakuhachi
  223. sihl < "0.2.0" | >= "0.3.0~rc2"
  224. sihl-core
  225. simple_httpd
  226. slack
  227. slug
  228. smaws-lib
  229. smtml >= "0.7.0"
  230. snf_mcp
  231. spectrum_palette_ppx
  232. spotify-web-api
  233. swagger
  234. talon < "1.0.0~alpha3"
  235. tdigest < "2.1.0"
  236. testcontainers
  237. textmate-language >= "0.3.4"
  238. textrazor >= "0.1.1"
  239. tidy_email_sendgrid
  240. timedesc < "0.8.0"
  241. timedesc-json
  242. timere < "0.4.0"
  243. user-agent-parser
  244. vecosek
  245. vercel
  246. vscoq-language-server < "2.3.3"
  247. vsrocq-language-server
  248. wasm_of_ocaml-compiler
  249. webauthn
  250. why3find
  251. xapi-rrd >= "1.9.0"
  252. yultracer
  253. zanuda
  254. zarr

Conflicts

None