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.

Added to opam-repository:

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. awskit-lwt-unix
  14. awskit-s3
  15. awsm-codegen
  16. awso
  17. awso-common
  18. bap-radare2
  19. beluga >= "1.1"
  20. bitcoin >= "3.0"
  21. bizowie-api
  22. boulangerie
  23. builder-web >= "0.2.0"
  24. cabal
  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. current_docker
  43. current_examples
  44. current_git
  45. current_github
  46. current_gitlab
  47. current_slack
  48. current_ssh
  49. current_web
  50. dap
  51. daypack-lib
  52. dblp-api
  53. decoders-yojson >= "0.7.0"
  54. devkit
  55. dnsrobot
  56. docker-api >= "0.2.2"
  57. docker_hub
  58. dot-merlin-reader < "4.9"
  59. dream
  60. dream-inertia
  61. dune-release >= "1.4.0"
  62. dune_deps_extra
  63. ecma-regex
  64. eio_main >= "0.10"
  65. elasticsearch-cli = "0.5"
  66. elpi >= "3.3.1"
  67. fehu < "1.0.0~alpha3"
  68. fiat-p256
  69. fit >= "1.2.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. grace >= "0.4.0"
  87. gradescope_submit
  88. graphql < "0.9.0" | >= "0.14.0"
  89. graphql-async >= "0.14.0"
  90. graphql-cohttp >= "0.13.0"
  91. graphql-lwt >= "0.14.0"
  92. graphql_ppx
  93. gremlin
  94. guardian
  95. h2
  96. hacl_x25519
  97. handlebars-ml
  98. hegel
  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. jsonkit
  117. jsonrpc < "1.6.0" | >= "1.23.1"
  118. jsonschema
  119. jsonschema-core
  120. jsonschema2atd
  121. jupyter
  122. jupyter-kernel
  123. jwto
  124. kappa-agents >= "4.1.3"
  125. kappa-binaries >= "4.1.3"
  126. kappa-library
  127. karamel
  128. kaun >= "1.0.0~alpha1" & < "1.0.0~alpha3"
  129. kind2
  130. kremlin < "transition"
  131. kubecaml
  132. lablgtk3-extras >= "3.0.1"
  133. lambdapi
  134. learn-ocaml
  135. letsencrypt < "2.0.0"
  136. letters
  137. libsail
  138. lichess_api
  139. linol >= "0.2"
  140. linol-eio
  141. linol-lwt
  142. lockfree >= "0.3.1"
  143. logs-async-reporter >= "1.3"
  144. lsp
  145. melange-json = "1.2.0"
  146. melange-json-native
  147. merlin != "4.5-411"
  148. metadb
  149. miaou-core
  150. miaou-driver-web
  151. mirage-crypto-ec
  152. mjson
  153. monorobot
  154. mopsa
  155. morbig >= "0.11.0"
  156. multicore-bench
  157. mutaml
  158. nats-client
  159. nats-client-async
  160. neo4j_bolt
  161. nloge
  162. noise
  163. nsq
  164. obuilder
  165. ocaml-lsp-server
  166. ocaml-protoc-plugin >= "6.1.0"
  167. ocaml_db_model
  168. ocaml_pgsql_model
  169. ocamleditor
  170. ocf
  171. ochre
  172. ocsigen-start
  173. odoc >= "3.0.0"
  174. odoc-driver
  175. oframl
  176. oidc
  177. ojs-base
  178. ojs_base
  179. ometrics < "0.2.0"
  180. opam-check-npm-deps >= "4.1.0"
  181. openai-gym
  182. openapi < "1.0.0"
  183. openapi_router
  184. opencage
  185. openstellina
  186. opium >= "0.19.0"
  187. oraft
  188. orun
  189. osh
  190. oui
  191. ozulip
  192. pa_ppx < "0.19"
  193. pandoc
  194. pbrt_yojson
  195. pds-reachability >= "0.2.3"
  196. pgn_parser
  197. phylogenetics >= "0.2.0"
  198. piece_rope
  199. pkcs11 >= "1.0.0"
  200. pkcs11-driver >= "1.0.0"
  201. playwright
  202. polymarket
  203. ppx_deriving_jsonschema
  204. ppx_deriving_yojson
  205. ppx_hegel_test
  206. ppx_protocol_conv_json >= "5.2.1"
  207. ppx_yojson
  208. ppx_yojson_conv_lib
  209. prof_spacetime
  210. pxshot
  211. qdrant
  212. qmp >= "0.19.0"
  213. quests
  214. r2pipe
  215. radare2
  216. rdf < "1.0.0"
  217. records >= "1.0.0"
  218. repr-bench
  219. rescriptdep
  220. rfsm >= "2.2"
  221. rocq-devtools
  222. rpclib
  223. rungen
  224. SZXX
  225. safemoney
  226. saga
  227. sail < "0.15"
  228. saturn
  229. saturn_lockfree
  230. satyrographos >= "0.0.2.8"
  231. savvy
  232. semver2
  233. serde_json
  234. shakuhachi
  235. sihl < "0.2.0" | >= "0.3.0~rc2"
  236. sihl-core
  237. simple_httpd
  238. slack
  239. slug
  240. smaws-lib
  241. smtml >= "0.7.0"
  242. snf_mcp
  243. soteria
  244. spectrum_palette_ppx
  245. spotify-web-api
  246. sqlgg >= "20260721"
  247. swagger
  248. talon < "1.0.0~alpha3"
  249. tdigest < "2.1.0"
  250. testcontainers
  251. textmate-language >= "0.3.4"
  252. textrazor >= "0.1.1"
  253. tidy_email_sendgrid
  254. timedesc < "0.8.0"
  255. timedesc-json
  256. timere < "0.4.0"
  257. transom
  258. user-agent-parser
  259. vecosek
  260. vercel
  261. vscoq-language-server < "2.3.3"
  262. vsrocq-language-server
  263. wasm_of_ocaml-compiler
  264. wax
  265. wax-lib
  266. webauthn
  267. why3find
  268. xapi-rrd >= "1.9.0"
  269. yultracer
  270. zanuda
  271. zarr

Conflicts

None