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

Conflicts

None