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.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"

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

Conflicts

None