node.jsclojurescripttransit

Transit-cljs reader handler to read in array


I am new Clojurescript and want to do some hacking this long weekend, to port over a NodeJS app. My http response has a JSON structure as follows-

{
 "key1":"foo",
 "rows":[{"name":"alice"},{"friend":"bob"}]
}

What should my reader handler to make sure I get the rows and the values of the array elements? Thanks in advance.


Solution

  • Transit-cljs will handle all of these types automatically for you, you shouldn't need to do anything special to handle it when sending or receiving this.

    Transit is an alternate format to JSON for transferring representations of data. If you want to use Transit then your server will need to emit Transit data and your client will need to parse it. It doesn't make sense to talk about using Transit in ClojureScript when your communication with the server is in JSON.