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 [:first :last])` for this example.
My two questions are:
1) Can you do this with destructuring? I see lots of examples of
destructuring a map into key values, but I wasn't sure if you could
destructure a map into another map.
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.
Thanks!
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en