{"id":13800625,"url":"https://github.com/tailrecursion/cljson","last_synced_at":"2025-10-21T22:39:09.065Z","repository":{"id":8889917,"uuid":"10609283","full_name":"tailrecursion/cljson","owner":"tailrecursion","description":"Clojure/ClojureScript library for accelerated browser data deserialization","archived":false,"fork":false,"pushed_at":"2015-10-21T00:49:48.000Z","size":847,"stargazers_count":62,"open_issues_count":3,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-21T22:39:04.805Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tailrecursion.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-06-10T20:55:20.000Z","updated_at":"2023-10-28T20:57:31.000Z","dependencies_parsed_at":"2022-08-28T05:00:56.705Z","dependency_job_id":null,"html_url":"https://github.com/tailrecursion/cljson","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/tailrecursion/cljson","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tailrecursion%2Fcljson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tailrecursion%2Fcljson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tailrecursion%2Fcljson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tailrecursion%2Fcljson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tailrecursion","download_url":"https://codeload.github.com/tailrecursion/cljson/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tailrecursion%2Fcljson/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280348047,"owners_count":26315367,"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","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-08-04T00:01:14.513Z","updated_at":"2025-10-21T22:39:09.049Z","avatar_url":"https://github.com/tailrecursion.png","language":"Clojure","funding_links":[],"categories":["Awesome ClojureScript"],"sub_categories":["Data Serialization"],"readme":"# DEPRECATED\n\nAs of 10/20/2015, this library is in maintenance mode.  We will continue to review pull requests for bug fixes, but for new projects, consider using [transit-cljs](https://github.com/cognitect/transit-cljs) instead.  While built on the same idea of using JSON as the transport format, it is probably more efficient and supports interchange between a multitude of platforms beyond Clojure and ClojureScript.\n\nWe have been using Transit for the past few months ourselves in [Hoplon](http://hoplon.io) and it has been a good experience so far.\n\n# cljson\n\nUse cljson to send data between Clojure and ClojureScript applications using\nJSON as the data transfer format. The cljson library has implementations for\nClojure and ClojureScript and supports all the data types that ClojureScript\nsupports, including tagged literals and metadata.\n\n![perf chart][2]\n\n## Install [![Build Status][1]][3]\n\nArtifacts are published on [Clojars][4].\n\n![latest version][5]\n\n## Usage\n\nThere are two functions exported by this library: `clj-\u003ecljson` and\n`cljson-\u003eclj`.  They convert Clojure data to and from JSON strings.\n\n```clojure\nuser=\u003e (require '[tailrecursion.cljson :refer [clj-\u003ecljson cljson-\u003eclj]])\nnil\n\nuser=\u003e (clj-\u003ecljson [1 2 3])\n\"[\\\"v\\\",1,2,3]\"\n\nuser=\u003e (cljson-\u003eclj \"[\\\"v\\\",1,2,3]\")\n[1 2 3]\n\nuser=\u003e (clj-\u003ecljson '(1 2 3))\n\"[\\\"l\\\",1,2,3]\"\n\nuser=\u003e (cljson-\u003eclj \"[\\\"l\\\",1,2,3]\")\n(1 2 3)\n\nuser=\u003e (clj-\u003ecljson [(java.util.Date.) {[1 2 3] :foo 'bar #{\"bar\"}}])\n\"[\\\"v\\\",[\\\"inst\\\",\\\"2013-06-24T17:34:04.183-00:00\\\"],[\\\"m\\\",[\\\"v\\\",1,2,3],[\\\"k\\\",\\\"foo\\\"],[\\\"y\\\",\\\"bar\\\"],[\\\"s\\\",\\\"bar\\\"]]]\"\n\nuser=\u003e (cljson-\u003eclj \"[\\\"v\\\",[\\\"inst\\\",\\\"2013-06-24T17:34:04.183-00:00\\\"],[\\\"m\\\",[\\\"v\\\",1,2,3],[\\\"k\\\",\\\"foo\\\"],[\\\"y\\\",\\\"bar\\\"],[\\\"s\\\",\\\"bar\\\"]]]\")\n[#inst \"2013-06-24T17:34:04.183-00:00\" {[1 2 3] :foo, bar #{\"bar\"}}]\n\nuser\u003e (defrecord Person [name])\nuser.Person\nuser\u003e (clj-\u003ecljson (Person. \"Bob\"))\n\"[\\\"user.Person\\\",[\\\"m\\\",[\\\"k\\\",\\\"name\\\"],\\\"Bob\\\"]]\"\nuser\u003e (binding [*data-readers* {'user.Person map-\u003ePerson}] (cljson-\u003eclj \"[\\\"user.Person\\\",[\\\"m\\\",[\\\"k\\\",\\\"name\\\"],\\\"Bob\\\"]]\"))\n#user.Person{:name \"Bob\"}\n```\n\n### Tagged Literals\n\nCljson provides the `EncodeTagged` protocol which can be extended to user types\nand records. This protocol is used to transform a Clojure/ClojureScript thing\ninto JSON-ready data.\n\nIf a type does not satisfy this protocol then cljson will use the core printer\nto obtain a printed representation of the thing. If the printed representation\nis a tagged literal then the data part is reread and converted to JSON-ready\ndata.\n\nReading of tagged literals is done via the normal tagged literal mechanisms\nbuilt into Clojure and ClojureScript.\n\nHave a look at _cljson.clj_ and _cljson.cljs_ to see examples of this.\n\n### Metadata\n\nBind `*print-meta*` to `true` to have metadata included in the JSON output.\n\n### ClojureScript and Records\n\nUnlike `clojure.core`, ClojureScript lacks a `*data-readers*` dynamic var. Instead, use [cljs.reader](https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/reader.cljs)'s `register-tag-parser!` function to declare constructors for records and types:\n\n```clojure\n(ns example\n  (:require [tailrecursion.cljson :refer [clj-\u003ecljson cljson-\u003eclj]]\n            [cljs.reader          :refer [register-tag-parser!]]))\n\n(defrecord Person [name])\n(register-tag-parser! \"example.Person\" map-\u003ePerson)\n(print (cljson-\u003eclj (clj-\u003ecljson (Person. \"Bob\")))) ;=\u003e #example.Person{:name Bob} \n```\n\n## License\n\nCopyright © 2013 Alan Dipert and Micha Niskin\n\nDistributed under the Eclipse Public License, the same as Clojure.\n\n[1]: https://travis-ci.org/tailrecursion/cljson.png?branch=master\n[2]: https://docs.google.com/a/thefreshdiet.com/spreadsheet/oimg?key=0AveuiOwXIG2PdEFRYXo0RV9YTjIwa1lPaDVNSzU1M1E\u0026oid=5\u0026zx=4oukjhd76v9a\n[3]: https://travis-ci.org/tailrecursion/cljson\n[4]: http://clojars.org/tailrecursion/cljson\n[5]: http://clojars.org/tailrecursion/cljson/latest-version.svg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftailrecursion%2Fcljson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftailrecursion%2Fcljson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftailrecursion%2Fcljson/lists"}