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"

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

Conflicts

None

Build status

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