-
Notifications
You must be signed in to change notification settings - Fork 20
Getting Started
David Nolen edited this page Dec 20, 2014
·
14 revisions
In order to read Transit encoded JSON you need to construct a reader:
(ns try-transit
(:require [cognitect.transit :as t]))
(def r (t/reader :json))
Currently :json
is the only type of reader available. The above
will construct a reader instance which has only one method, read
.
Reading a Transit array encoding will produce a persistent vector:
(def v (t/read r "[1,2,3]")) ;; [1 2 3]
Reading a Transit map encoding will produce a persistent map.
(def m (t/read r "{\"~:foo\":\"bar\"}")) ;; {:foo "bar"}