Re: limit keys from client JSON (select-keys but nested?)

2013-01-01 Thread Stuart Sierra
data.json 0.2.x allows transformation functions to be applied to data as it is read in. http://clojure.github.com/data.json/#clojure.data.json/read -S -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@goog

Re: limit keys from client JSON (select-keys but nested?)

2013-01-01 Thread Carlo Zancanaro
> 2) Is there a good way of doing this with nested maps? An example: > > { :user { :first "John" :last "Doe" :dob { :month 12 :day 30 :year 2012 > :garbage "asdf" } } } > > I would want to make sure :dob only contains keys :month, :day, :year. I'd write a simple little helper function to do this,

Re: limit keys from client JSON (select-keys but nested?)

2013-01-01 Thread Ghislain Hachey
On Monday, December 31, 2012 3:13:42 AM UTC+11, Huey Petersen wrote: > > > 2) Is there a good way of doing this with nested maps? An example: > > { :user { :first "John" :last "Doe" :dob { :month 12 :day 30 :year 2012 > :garbage "asdf" } } } > > I would want to make sure :dob only contains keys

limit keys from client JSON (select-keys but nested?)

2012-12-30 Thread Huey Petersen
Hello, I have client providing JSON data that is read into a map. What I'm wondering is what is the best way to limit the data to only keys I white list. { :user { :first "John" :last "Doe" :role "admin" } } In this example I wouldn't want to read the role key. I can do `(select-keys user [