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

    • S24-W48/49, S24-W50/51/52
    • 1

      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.

            arimdjonoks Artjoms Rimdjonoks
            zalex_ua Oleksii Zagorskyi
            Team C
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - Not Specified
                Not Specified
                Logged:
                Time Spent - 8h
                8h