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

Conflicts

None