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.

Published: 09 Jun 2022

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

Conflicts

None