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

Conflicts

None