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

Conflicts

None