Created 06-21-2023 11:15 AM
We are having escaping issues in some expressions. Just an example (using Nifi 1.21.0):
Expression | Value |
{"$${key}": "value"} | {"${key}": "value"} |
{"$${key}": "${literal('value')}"} | {"$${key}": "value"} |
As one can see, the second expression is not escaping the dollar sign as it should (from the docs, see "Escaping Expression Language"), and just stays as "$$".
Any comments/hints would be much appreciated.
Created 06-21-2023 01:46 PM
@jisaitua
Definitely some weird unexpected behavior there. I was able to reproduce your issue, as well as some other unexpected behavior around same area.
As a workaround to your specific issue, the following NiFi Expression Language (NEL) will get you what you are looking for:
{${literal('')}"$${key}":"${literal('value')}"}
I also filed an Apache NiFi jira for this issue:
https://issues.apache.org/jira/browse/NIFI-11738
I reproduced on an Apache NiFi 1.18 cluster I have running, so it is not an issue that just recently appeared.
If you found that the provided solution(s) assisted you with your query, please take a moment to login and click Accept as Solution below each response that helped.
Thank you,
Matt
Created 06-21-2023 04:47 PM
Thank you @MattWho, the trick worked! Sadly, it worked for this simple case, but for more complex cases we couldn't find a pattern to apply it. However, we found another workaround by using literals like this:
Expression | Value |
{ | { |
It's a nasty hack, but it gets the job done! Thanks again for your help and for filling a bug report.
Created 06-21-2023 01:46 PM
@jisaitua
Definitely some weird unexpected behavior there. I was able to reproduce your issue, as well as some other unexpected behavior around same area.
As a workaround to your specific issue, the following NiFi Expression Language (NEL) will get you what you are looking for:
{${literal('')}"$${key}":"${literal('value')}"}
I also filed an Apache NiFi jira for this issue:
https://issues.apache.org/jira/browse/NIFI-11738
I reproduced on an Apache NiFi 1.18 cluster I have running, so it is not an issue that just recently appeared.
If you found that the provided solution(s) assisted you with your query, please take a moment to login and click Accept as Solution below each response that helped.
Thank you,
Matt
Created 06-21-2023 04:47 PM
Thank you @MattWho, the trick worked! Sadly, it worked for this simple case, but for more complex cases we couldn't find a pattern to apply it. However, we found another workaround by using literals like this:
Expression | Value |
{ | { |
It's a nasty hack, but it gets the job done! Thanks again for your help and for filling a bug report.