Clojure获取映射中的值
如何在这样的地图中获取openid.id或任何其他字段 :openid.com\u id不起作用Clojure获取映射中的值,clojure,hashmap,Clojure,Hashmap,如何在这样的地图中获取openid.id或任何其他字段 :openid.com\u id不起作用 {"openid.response_nonce" "2015-07-25T09:31:45ZXrcrR0Lk35St5ESZQ0tg40PbBXU=", "openid.identity" "http://steamcommunity.com/openid/id/xxx", "openid.ns" "http://specs.openid.net/auth/2.0", "openid.op_endp
{"openid.response_nonce" "2015-07-25T09:31:45ZXrcrR0Lk35St5ESZQ0tg40PbBXU=", "openid.identity" "http://steamcommunity.com/openid/id/xxx", "openid.ns" "http://specs.openid.net/auth/2.0", "openid.op_endpoint" "https://steamcommunity.com/openid/login", "openid.mode" "id_res", "openid.sig" "zuiyNzf/QLP9Ci/czElIo1Z3nE0=", "openid.signed" "signed,op_endpoint,claimed_id,identity,return_to,response_nonce,assoc_handle", "openid.assoc_handle" "1234567890", "openid.claimed_id" "http://steamcommunity.com/openid/id/xxx", "openid.return_to" "http://localhost:3000/resp"}
地图中的键是字符串,而不是关键字 您可以使用:
(get m "openid.claimed_id")
或者,您可以先将字符串键转换为关键字,然后根据关键字进行查找:
(:openid.claimed_id (clojure.walk/keywordize-keys m))
地图中的键是字符串,而不是关键字 您可以使用:
(get m "openid.claimed_id")
或者,您可以先将字符串键转换为关键字,然后根据关键字进行查找:
(:openid.claimed_id (clojure.walk/keywordize-keys m))
由于映射也是一个可以自己查找的函数,因此最简单的方法是
(m "openid.claimed_id")
使用
m
作为您的映射。由于映射也是一个可以自己进行查找的函数,最简单的方法是
(m "openid.claimed_id")
以m
作为您的地图