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

Conflicts

None