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

Conflicts

None