dragonfly icon indicating copy to clipboard operation
dragonfly copied to clipboard

json type not support root path as '.' , so some tools or code may throw error

Open liuzhuoling2011 opened this issue 2 years ago • 5 comments

W20230214 08:41:52.302026 11 json_family.cc:1611] path '.': Invalid JSONPath syntax: Expected '$' or function expression

image

liuzhuoling2011 avatar Feb 16 '23 03:02 liuzhuoling2011

Can you please provide the full redis-cli command that triggers this error?

On Thu, Feb 16, 2023, 05:43 liuzhuoling @.***> wrote:

W20230214 08:41:52.302026 11 json_family.cc:1611] path '.': Invalid JSONPath syntax: Expected '$' or function expression

[image: image] https://user-images.githubusercontent.com/8407297/219262407-9924d889-b033-4bd8-98bb-56a02cd198dd.png

— Reply to this email directly, view it on GitHub https://github.com/dragonflydb/dragonfly/issues/811, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA4BFCHMK44DCTGZQXIQW7LWXWO4VANCNFSM6AAAAAAU5UMG2Q . You are receiving this because you are subscribed to this thread.Message ID: @.***>

romange avatar Feb 16 '23 03:02 romange

The tool is RedisInsight

Here is the code: image

liuzhuoling2011 avatar Feb 16 '23 04:02 liuzhuoling2011

  1. The current implementation of json.get gets two required arguments key and path. I suggest adding the path argument to be an optional argument and in case it's not supplied the code should query the root key.
  2. .foo is not valid enhanced path syntax which is explained here: https://goessner.net/articles/JsonPath/ the syntax that you used is called restricted path syntax and it's not supported by the JSON library that the code is using.

iko1 avatar Feb 16 '23 22:02 iko1

@iko1 Thanks for your kind help

  1. for redisinsight tool, I find it use 'json.debug memory' command but dragonfly not have, so throw error
  2. for jsonpath style, maybe I need change my habits, lol

liuzhuoling2011 avatar Feb 17 '23 04:02 liuzhuoling2011

@romange Hi, I find the reason why redisinsight cant work

  1. JSON.SET key path value [NX | XX] current version not support [NX | XX] params
  2. JSON.DEBUG MEMORY key [path] current version not support memory params

liuzhuoling2011 avatar Feb 17 '23 04:02 liuzhuoling2011