[ZBX-18651] JSON / JSONPATH escaped value causing unsupported construct in jsonpath Created: 2020 Nov 13 Updated: 2020 Nov 17 Resolved: 2020 Nov 17 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Templates (T) |
Affects Version/s: | 5.0.5 |
Fix Version/s: | None |
Type: | Incident report | Priority: | Trivial |
Reporter: | Evren Yurtesen | Assignee: | Zabbix Development Team |
Resolution: | Won't fix | Votes: | 0 |
Labels: | escape, jsonpath, template, unescape | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Attachments: |
![]() |
Description |
Steps to reproduce:
$.value.['{#JMXOBJ}']
name=\"PC|Ernesto\" enabled
Result: cannot extract value from json by path "$.value.['name=\"PC|Ernesto\" enabled']": unsupported construct in jsonpath starting with: "\"PC|Ernesto\" enabled']" Expected: The beginning of the issue is that I am collecting JMX attributes as JSON { "{#JMXVALUE}":"5", "{#JMXTYPE}":"java.lang.Integer", "{#JMXOBJ}":"name=\"PC|Ernesto\" enabled", "{#JMXDESC}":"Attribute exposed for management", "{#JMXATTR}":"Value" },
The {#JMXOBJ} is escaped by default. There is no way to unescape it when giving it to item prototype. |
Comments |
Comment by Alexander Vladishev [ 2020 Nov 17 ] |
This works as described in the documentation. There is nothing to fix. Please user double quotes instead of single: $.value.["{#JMXOBJ}"] |
Comment by Evren Yurtesen [ 2020 Nov 17 ] |
@sasha thank you very much. I saw that manual before but did not realize the difference in quotes. I think my confusion is because at many other examples only single quotes are used. Eg. https://goessner.net/articles/JsonPath/index.html Including zabbix manual: |