ReJson - 从第二层键的匹配中检索所有值
ReJson - Retrieve all values from matches of 2nd layer of keys
我正在尝试获取二级键相同的所有值。 ReJson 是否支持此功能?
例如:
JSON.SET myKey . '{"book1": {"author":"xyz", "price":100}, "book2": {"author":"abc", "price":200}}'
JSON.GET myKey .book1.author
=> "\"xyz\""
JSON.GET myKey .book2.author
=> "\"abc\""
正在尝试获取所有作者的值
JSON.GET myKey ..author
出现以下错误:
(error) ERR Search path error at offset 2: an identifier can only begin with a letter, a dollar sign or an underscore - use bracket notation for anything else`
JSON.OBJKEYS myKey .
=> 1) "book1" 2) "book2"
文档说它确实支持 JSON PATH。
链接:https://oss.redislabs.com/rejson/ https://goessner.net/articles/JsonPath/
不,ReJSON 还没有提供那个功能。
docs 说:
ReJSON's syntax is a subset of common best practices and resembles JSONPath
尝试:
json.mget myKey $..author
我正在尝试获取二级键相同的所有值。 ReJson 是否支持此功能? 例如:
JSON.SET myKey . '{"book1": {"author":"xyz", "price":100}, "book2": {"author":"abc", "price":200}}'
JSON.GET myKey .book1.author
=> "\"xyz\""
JSON.GET myKey .book2.author
=> "\"abc\""
正在尝试获取所有作者的值
JSON.GET myKey ..author
出现以下错误:
(error) ERR Search path error at offset 2: an identifier can only begin with a letter, a dollar sign or an underscore - use bracket notation for anything else`
JSON.OBJKEYS myKey .
=> 1) "book1" 2) "book2"
文档说它确实支持 JSON PATH。
链接:https://oss.redislabs.com/rejson/ https://goessner.net/articles/JsonPath/
不,ReJSON 还没有提供那个功能。
docs 说:
ReJSON's syntax is a subset of common best practices and resembles JSONPath
尝试:
json.mget myKey $..author