When low-level discovery macros are used in JSONPath preprocessing and their values are resolved, the following rules of escaping special characters are applied:
For example:
JSONPath | LLD macro value | After substitution |
---|---|---|
$.[?(@.value == "{#MACRO}")] | special "value" | $.[?(@.value == "special \"value\"")] |
c:\temp | $.[?(@.value == "c:\\temp")] | |
a\\b | $.[?(@.value == "a\\\\b")] |
When used in the expression, the macro that may have special characters should be enclosed in double quotes:
JSONPath | LLD macro value | After substitution | Result |
---|---|---|---|
$.[?(@.value == "{#MACRO}")] | special "value" | $.[?(@.value == "special \"value\"")] | OK |
$.[?(@.value == {#MACRO})] | $.[?(@.value == special \"value\")] | Bad JSONPath expression |
When used in the path, the macro that may have special characters should be enclosed in square brackets and double quotes:
JSONPath | LLD macro value | After substitution | Result |
---|---|---|---|
$.["{#MACRO}"].value | c:\temp | $.["c:\\temp"].value | OK |
$.{#MACRO}.value | $.c:\\temp.value | Bad JSONPath expression |