{"id":13760463,"url":"https://github.com/metosin/jsonista","last_synced_at":"2025-06-23T02:10:52.107Z","repository":{"id":21297267,"uuid":"92176815","full_name":"metosin/jsonista","owner":"metosin","description":"Clojure library for fast JSON encoding and decoding.","archived":false,"fork":false,"pushed_at":"2025-05-26T09:56:48.000Z","size":1977,"stargazers_count":448,"open_issues_count":18,"forks_count":30,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-06-16T04:17:54.662Z","etag":null,"topics":["clojure","jackson","json","metosin-stable"],"latest_commit_sha":null,"homepage":"https://cljdoc.org/d/metosin/jsonista","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/metosin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-05-23T13:34:37.000Z","updated_at":"2025-06-04T17:48:44.000Z","dependencies_parsed_at":"2025-06-16T04:10:28.304Z","dependency_job_id":"5213b2f5-3e83-4137-8d79-3c3eb7957324","html_url":"https://github.com/metosin/jsonista","commit_stats":{"total_commits":138,"total_committers":15,"mean_commits":9.2,"dds":"0.39855072463768115","last_synced_commit":"906756f62581de1570984f4fd4f8433c1cacbc95"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/metosin/jsonista","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metosin%2Fjsonista","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metosin%2Fjsonista/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metosin%2Fjsonista/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metosin%2Fjsonista/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/metosin","download_url":"https://codeload.github.com/metosin/jsonista/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metosin%2Fjsonista/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260947954,"owners_count":23087472,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clojure","jackson","json","metosin-stable"],"created_at":"2024-08-03T13:01:10.770Z","updated_at":"2025-06-23T02:10:47.093Z","avatar_url":"https://github.com/metosin.png","language":"Clojure","funding_links":[],"categories":["Clojure","JSON"],"sub_categories":[],"readme":"# jsonista [![Continuous Integration status](https://github.com/metosin/jsonista/workflows/Run%20tests/badge.svg?event=push)](https://github.com/metosin/jsonista/actions) [![cljdoc badge](https://cljdoc.xyz/badge/metosin/jsonista)](https://cljdoc.xyz/d/metosin/jsonista/CURRENT)\n\n\u003e *jsonissa / jsonista / jsoniin, jsonilla / jsonilta / jsonille*\n\nClojure library for fast JSON encoding and decoding.\n\n* Explicit configuration\n* Uses [jackson-databind](https://github.com/FasterXML/jackson-databind)\n* Mostly written in Java for speed\n* [API docs](https://cljdoc.org/d/metosin/jsonista/CURRENT/api/jsonista)\n* [FAQ](https://cljdoc.org/d/metosin/jsonista/CURRENT/doc/frequently-asked-questions)\n\nFaster than [data.json](https://github.com/clojure/data.json) or [Cheshire](https://github.com/dakrone/cheshire) while still having the necessary features for web development. Designed for use with [Muuntaja](https://github.com/metosin/muuntaja).\n\nBlogged:\n* [Faster JSON processing with jsonista](http://www.metosin.fi/blog/faster-json-processing-with-jsonista/)\n\n\u003e Hi! We are [Metosin](https://metosin.fi), a consulting company. These libraries have evolved out of the work we do for our clients.\n\u003e We maintain \u0026 develop this project, for you, for free. Issues and pull requests welcome!\n\u003e However, if you want more help using the libraries, or want us to build something as cool for you, consider our [commercial support](https://www.metosin.fi/en/open-source-support).\n\n## Latest version\n\n[![Clojars Project](http://clojars.org/metosin/jsonista/latest-version.svg)](http://clojars.org/metosin/jsonista)\n\nRequires Java1.8+\n\n## Quickstart\n\n```clojure\n(require '[jsonista.core :as j])\n\n(j/write-value-as-string {\"hello\" 1})\n;; =\u003e \"{\\\"hello\\\":1}\"\n\n(j/read-value *1)\n;; =\u003e {\"hello\" 1}\n```\n\n## Examples\n\nUsing explicit ObjectMapper:\n\n```clj\n(-\u003e {:dog {:name \"Teppo\"}}\n    (j/write-value-as-bytes j/default-object-mapper)\n    (j/read-value j/default-object-mapper))\n;; =\u003e {\"dog\" {\"name\" \"Teppo\"}}\n```\n\nUsing keyword keys:\n\n```clj\n(-\u003e {:dog {:name \"Teppo\"}}\n    (j/write-value-as-bytes j/keyword-keys-object-mapper)\n    (j/read-value j/keyword-keys-object-mapper))\n;; =\u003e {:dog {:name \"Teppo\"}}\n```\n\nChanging how map keys are encoded \u0026 decoded:\n\n```clojure\n(defn reverse-string [s] (apply str (reverse s)))\n\n(def mapper\n  (j/object-mapper\n    {:encode-key-fn (comp reverse-string name)\n     :decode-key-fn (comp keyword reverse-string)}))\n\n(-\u003e {:kikka \"kukka\"}\n    (doto prn)\n    (j/write-value-as-string mapper)\n    (doto prn)\n    (j/read-value mapper)\n    (prn))\n; {:kikka \"kukka\"}\n; \"{\\\"akkik\\\":\\\"kukka\\\"}\"\n; {:kikka \"kukka\"}\n```\n\nReading \u0026 writing directly into a file:\n\n```clojure\n(def file (java.io.File. \"hello.json\"))\n\n(j/write-value file {\"hello\" \"world\"})\n\n(slurp file)\n;; =\u003e \"{\\\"hello\\\":\\\"world\\\"}\"\n\n(j/read-value file)\n;; =\u003e {\"hello\" \"world\"}\n```\n\nAdding support for [joda-time](http://www.joda.org/joda-time) Classes, used by [clj-time](https://github.com/clj-time/clj-time).\n\n```clj\n;; [com.fasterxml.jackson.datatype/jackson-datatype-joda \"2.9.5\"]\n(import '[com.fasterxml.jackson.datatype.joda JodaModule])\n(import '[org.joda.time LocalDate])\n\n(def mapper\n  (j/object-mapper\n    {:modules [(JodaModule.)]}))\n\n(j/write-value-as-string (LocalDate. 0) mapper)\n; \"\\\"1970-01-01\\\"\"\n```\n\n### Tagged JSON\n\nAdding support for lossless encoding data using tagged values. This\nincludes both reading and writing support.\n\n```clj\n(def mapper\n  (j/object-mapper\n    {:encode-key-fn true\n     :decode-key-fn true\n     :modules [(jt/module\n                 {:handlers {Keyword {:tag \"!kw\"\n                                      :encode jt/encode-keyword\n                                      :decode keyword}\n                             PersistentHashSet {:tag \"!set\"\n                                                :encode jt/encode-collection\n                                                :decode set}}})]}))\n\n(-\u003e {:system/status #{:status/good}}\n    (j/write-value-as-string mapper)\n    (doto prn)\n    (j/read-value mapper))\n; prints \"{\\\"system/status\\\":[\\\"!set\\\",[[\\\"!kw\\\",\\\"status/good\\\"]]]}\"\n; =\u003e {:system/status #{:status/good}}\n```\n\nIn simple [perf tests](https://github.com/metosin/jsonista/blob/master/test/jsonista/json_perf_test.clj), tagged JSON is much faster than EDN or Transit.\n\n## Streaming\n\nSee [docs/streaming.md](docs/streaming.md).\n\n## Performance\n\n* All standard encoders and decoders are written in Java\n* Protocol dispatch with `read-value` \u0026 `write-value`\n* Jackson `ObjectMapper` is used directly\n* Small functions to support JVM Inlining\n\nMeasured using [lein-jmh](https://github.com/jgpc42/lein-jmh),\nsee [perf-tests](/test/jsonista/jmh.clj) for details.\n\n### Throughput, relative\n\n![encode](/docs/json-encode.png)\n\n![decode](/docs/json-decode.png)\n\n### Throughput, absolute\n\n![encode](/docs/json-encode-t.png)\n\n![decode](/docs/json-decode-t.png)\n\n### Throughput, data\n\n```bash\n➜  jsonista git:(master) ✗ lein jmh '{:file \"benchmarks.edn\", :type :quick, :format :table}'\n{:% 100.0 :eta \"00:00:00\"}\n\n:benchmark                     :name    :mode        :samples  :score              :score-error  :params\n-----------------------------  -------  -----------  --------  ------------------  ------------  --------------\njsonista.jmh/encode-data-json  :encode  :throughput  5         2011809.137  ops/s  12600.809     {:size \"10b\"}\njsonista.jmh/encode-data-json  :encode  :throughput  5         382677.707   ops/s  2861.142      {:size \"100b\"}\njsonista.jmh/encode-data-json  :encode  :throughput  5         66403.631    ops/s  597.436       {:size \"1k\"}\njsonista.jmh/encode-data-json  :encode  :throughput  5         5480.185     ops/s  58.379        {:size \"10k\"}\njsonista.jmh/encode-data-json  :encode  :throughput  5         576.691      ops/s  15.682        {:size \"100k\"}\njsonista.jmh/encode-cheshire   :encode  :throughput  5         996875.314   ops/s  5688.227      {:size \"10b\"}\njsonista.jmh/encode-cheshire   :encode  :throughput  5         482130.613   ops/s  2685.181      {:size \"100b\"}\njsonista.jmh/encode-cheshire   :encode  :throughput  5         128936.005   ops/s  879.709       {:size \"1k\"}\njsonista.jmh/encode-cheshire   :encode  :throughput  5         12209.066    ops/s  94.285        {:size \"10k\"}\njsonista.jmh/encode-cheshire   :encode  :throughput  5         1258.157     ops/s  12.340        {:size \"100k\"}\njsonista.jmh/encode-jsonista   :encode  :throughput  5         6356105.348  ops/s  85360.100     {:size \"10b\"}\njsonista.jmh/encode-jsonista   :encode  :throughput  5         2010379.039  ops/s  67648.165     {:size \"100b\"}\njsonista.jmh/encode-jsonista   :encode  :throughput  5         409264.663   ops/s  3704.992      {:size \"1k\"}\njsonista.jmh/encode-jsonista   :encode  :throughput  5         34527.245    ops/s  251.065       {:size \"10k\"}\njsonista.jmh/encode-jsonista   :encode  :throughput  5         2934.595     ops/s  15.858        {:size \"100k\"}\njsonista.jmh/encode-jackson    :encode  :throughput  5         6275467.563  ops/s  123578.482    {:size \"10b\"}\njsonista.jmh/encode-jackson    :encode  :throughput  5         2092035.098  ops/s  11417.613     {:size \"100b\"}\njsonista.jmh/encode-jackson    :encode  :throughput  5         408380.251   ops/s  10912.350     {:size \"1k\"}\njsonista.jmh/encode-jackson    :encode  :throughput  5         31992.554    ops/s  230.781       {:size \"10k\"}\njsonista.jmh/encode-jackson    :encode  :throughput  5         2887.485     ops/s  12.491        {:size \"100k\"}\njsonista.jmh/decode-data-json  :decode  :throughput  5         2257552.949  ops/s  23890.443     {:size \"10b\"}\njsonista.jmh/decode-data-json  :decode  :throughput  5         498261.935   ops/s  2348.572      {:size \"100b\"}\njsonista.jmh/decode-data-json  :decode  :throughput  5         85191.855    ops/s  321.961       {:size \"1k\"}\njsonista.jmh/decode-data-json  :decode  :throughput  5         7763.264     ops/s  250.502       {:size \"10k\"}\njsonista.jmh/decode-data-json  :decode  :throughput  5         771.691      ops/s  6.559         {:size \"100k\"}\njsonista.jmh/decode-cheshire   :decode  :throughput  5         1099821.870  ops/s  14796.659     {:size \"10b\"}\njsonista.jmh/decode-cheshire   :decode  :throughput  5         544013.773   ops/s  4122.539      {:size \"100b\"}\njsonista.jmh/decode-cheshire   :decode  :throughput  5         109517.975   ops/s  911.623       {:size \"1k\"}\njsonista.jmh/decode-cheshire   :decode  :throughput  5         10017.553    ops/s  50.871        {:size \"10k\"}\njsonista.jmh/decode-cheshire   :decode  :throughput  5         1014.003     ops/s  18.609        {:size \"100k\"}\njsonista.jmh/decode-jsonista   :decode  :throughput  5         3476196.425  ops/s  21535.641     {:size \"10b\"}\njsonista.jmh/decode-jsonista   :decode  :throughput  5         792773.466   ops/s  8209.591      {:size \"100b\"}\njsonista.jmh/decode-jsonista   :decode  :throughput  5         160180.797   ops/s  554.940       {:size \"1k\"}\njsonista.jmh/decode-jsonista   :decode  :throughput  5         14151.302    ops/s  107.906       {:size \"10k\"}\njsonista.jmh/decode-jsonista   :decode  :throughput  5         1508.829     ops/s  5.855         {:size \"100k\"}\njsonista.jmh/decode-jackson    :decode  :throughput  5         5145394.434  ops/s  84237.662     {:size \"10b\"}\njsonista.jmh/decode-jackson    :decode  :throughput  5         1339393.911  ops/s  6660.176      {:size \"100b\"}\njsonista.jmh/decode-jackson    :decode  :throughput  5         274465.912   ops/s  1589.614      {:size \"1k\"}\njsonista.jmh/decode-jackson    :decode  :throughput  5         29607.044    ops/s  183.068       {:size \"10k\"}\njsonista.jmh/decode-jackson    :decode  :throughput  5         2539.491     ops/s  17.753        {:size \"100k\"}\n```\n\n## Making a release\n\n- Update `CHANGELOG.md` and increment the version number in `project.clj`\n- Commit and push to Github\n- Create a Github release [here](https://github.com/metosin/jsonista/releases)\n  - Use the version number of the release for the tag name\n- The [Github Actions release workflow](.github/workflows/release.yml) should fire and deploy a release to clojars\n\n## License\n\nCopyright \u0026copy; 2016-2021 [Metosin Oy](http://www.metosin.fi).\n\nDistributed under the Eclipse Public License 2.0.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetosin%2Fjsonista","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetosin%2Fjsonista","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetosin%2Fjsonista/lists"}