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.0.1.tbz
sha256=8bc8bc722a4a94656a58394f17f9f8a406267343ab87d77202db930584a0c836
sha512=93ebabd3247f1b5826827472229188c5ac1b4d2395eb8121a22b35acd773eedd290e6b8de1f067020fc868da7c05a60408091eebc0b305a67408d558a3a94c10

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 *)

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. dune >= "2.0"
  4. ocaml >= "4.02.3"

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. atdml
  9. atproto
  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. bitcoin >= "3.0"
  21. bitflyer
  22. bizowie-api
  23. boulangerie
  24. boulodrome
  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"
  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. curve448
  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. elasticsearch-cli = "0.5"
  70. elpi >= "3.3.1"
  71. esgg >= "20260908"
  72. fehu < "1.0.0~alpha3"
  73. fiat-p256
  74. frama-c
  75. fred
  76. frenetic
  77. fstar
  78. fxmacrodata
  79. gapi-ocaml
  80. gdbprofiler
  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. graphql < "0.9.0" | >= "0.14.0"
  92. graphql-async >= "0.14.0"
  93. graphql-cohttp >= "0.13.0"
  94. graphql-lwt >= "0.14.0"
  95. graphql_ppx
  96. gremlin
  97. h2
  98. hacl_x25519
  99. handlebars-ml
  100. hegel < "0.24.1"
  101. hilite < "0.3.0"
  102. hl_yaml
  103. hockmd
  104. hpack
  105. hpke
  106. hsluv
  107. httph
  108. huml
  109. huml-cli
  110. index-bench
  111. ip2location
  112. ip2locationio
  113. irmin-graphql
  114. irmin-tezos
  115. jasmin
  116. jhupllib
  117. jose
  118. js_of_ocaml-compiler < "6.0.1"
  119. jsonkit
  120. jsonrpc < "1.6.0" | >= "1.23.1"
  121. jsonschema
  122. jsonschema-core
  123. jsonschema2atd
  124. jupyter
  125. jupyter-kernel
  126. jwto
  127. kappa-library
  128. karamel
  129. kaun >= "1.0.0~alpha1" & < "1.0.0~alpha3"
  130. kind2
  131. kremlin < "transition"
  132. kube
  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. lsp
  145. melange-json = "1.2.0"
  146. melange-json-native
  147. merlin != "4.5-411"
  148. metadb
  149. miaou-core
  150. miaou-driver-web
  151. mirage-crypto-ec
  152. mjson
  153. monorobot
  154. mopsa
  155. morbig >= "0.11.0"
  156. mutaml
  157. nats-client
  158. nats-client-async
  159. neo4j_bolt
  160. nloge
  161. noise
  162. nsq
  163. obuilder
  164. ocaml-lsp-server
  165. ocaml-protoc-plugin >= "6.1.0"
  166. ocaml_db_model
  167. ocaml_pgsql_model
  168. ocf
  169. ochre
  170. ocsigen-start
  171. odoc-driver
  172. oframl
  173. oidc
  174. ojs-base
  175. ojs_base
  176. ometrics < "0.2.0"
  177. opam-check-npm-deps >= "4.1.0"
  178. openai-gym
  179. openapi < "1.0.0"
  180. openapi_router
  181. opencage
  182. openstellina
  183. opium >= "0.19.0"
  184. oraft
  185. orun
  186. osh
  187. oui
  188. ozulip
  189. pa_ppx < "0.19"
  190. pandoc
  191. pbrt_yojson
  192. pds-reachability >= "0.2.3"
  193. pgn_parser
  194. phylogenetics >= "0.2.0"
  195. pkcs11 >= "1.0.0"
  196. pkcs11-driver >= "1.0.0"
  197. playwright
  198. polymarket
  199. ppx_deriving_jsonschema
  200. ppx_deriving_yojson
  201. ppx_hegel_test
  202. ppx_protocol_conv_json >= "5.2.1"
  203. ppx_yojson
  204. ppx_yojson_conv_lib
  205. prof_spacetime
  206. pxshot
  207. qdrant
  208. qmp >= "0.19.0"
  209. quests
  210. r2pipe
  211. radare2
  212. rdf < "1.0.0"
  213. records >= "1.0.0"
  214. repr-bench
  215. rescriptdep
  216. rfsm >= "2.2"
  217. rocq-devtools
  218. rpclib
  219. rungen
  220. SZXX
  221. safemoney
  222. saga
  223. sail < "0.15"
  224. satyrographos >= "0.0.2.8"
  225. savvy
  226. semver2
  227. shakuhachi
  228. sihl < "0.2.0" | >= "0.3.0~rc2"
  229. sihl-core
  230. simple_httpd
  231. slack
  232. slug
  233. smaws-lib
  234. smtml >= "0.7.0"
  235. snf_mcp
  236. sosie
  237. soteria
  238. spectrum_palette_ppx
  239. spotify-web-api
  240. sqlgg >= "20260721"
  241. swagger
  242. talon < "1.0.0~alpha3"
  243. tdigest < "2.1.0"
  244. testcontainers
  245. textmate-language >= "0.3.4"
  246. textrazor >= "0.1.1"
  247. tidy_email_sendgrid
  248. timedesc < "0.8.0"
  249. timedesc-json
  250. timere < "0.4.0"
  251. topup
  252. transom
  253. user-agent-parser
  254. vecosek
  255. vercel
  256. vscoq-language-server < "2.3.3"
  257. vsrocq-language-server
  258. wax
  259. wax-lib
  260. webauthn
  261. why3find
  262. xapi-rrd >= "1.9.0"
  263. yojson-bench = "2.0.1"
  264. yultracer
  265. zanuda
  266. zarr

Conflicts

None