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

Published: 02 May 2023

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

Conflicts

None