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

Conflicts

None