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.1.tbz
sha256=8bc8bc722a4a94656a58394f17f9f8a406267343ab87d77202db930584a0c836
sha512=93ebabd3247f1b5826827472229188c5ac1b4d2395eb8121a22b35acd773eedd290e6b8de1f067020fc868da7c05a60408091eebc0b305a67408d558a3a94c10

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

Conflicts

None