package yojson

Build not checked
  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"

Optional Dependencies

None

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

Conflicts

None

Build status

Results of building yojson with each compiler on check.ci.ocaml.org, run of against opam-repository 6e2873f. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

This version is not in the latest run; the versions below are.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
3.0.0 good good good good good
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure