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.0.2.tbz
sha256=876bb6f38af73a84a29438a3da35e4857c60a14556a606525b148c6fdbe5461b
sha512=9e150689a814a64e53e361e336fe826df5a3e3851d1367fda4a001392175c29348de55db0b7d7ba18539dec2cf78198efcb7f41b77a9861763f5aa97c05509ad

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"

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

Conflicts

None

Build status

Results of building yojson with each compiler on check.ci.ocaml.org, run of against opam-repository 78c202b. 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