Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-23103

JSONPath in zabbix does not support $ sign in object names

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Unresolved
    • Icon: Critical Critical
    • None
    • 6.0.19, 6.4.4
    • Server (S)
    • None

      Example of tested JSON and its path:

      {"f$o":"bar"}
      $.f$o
      

      If you will test it, you will get an error:

      cannot extract value from json by path "$.f$o": unsupported construct in jsonpath starting with: "$o"
      

      https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/src/libs/zbxjson/jsonpath.c#205

      I assume such object names were not considered when writing function "jsonpath_next":
      https://git.zabbix.com/projects/ZBX/repos/zabbix/browse/src/libs/zbxjson/jsonpath.c#522

       

      How does it work for "jq" tool, just an example:

      # echo '{"foo":"bar"}' | jq '.foo'
      "bar"
      
      # echo '{"f$o":"bar"}' | jq '."f$o"'
      "bar"
      

      Some web based tools, like https://jsonpath.com/ do not require any special syntax/formatting/escaping for the example.

            zabbix.dev Zabbix Development Team
            zalex_ua Oleksii Zagorskyi
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: