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

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

Conflicts

None