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.0.tbz
sha256=ab5d863f7f951a8f7fb4a708399ca2da2cf139a5e0af7818145c20295420cb1a
sha512=3ea982dbeef7ec8da54d29124ddb8b86f90583eb96ed3947851cedec9e3d2d47b981e3465d41f2c94943e6865ba6a9a51c6f0252efa6df2386d398b679aae8f2

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

Conflicts

None

Build status

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