[英]DataWeave 2.0 Backslash escaping
How can you get a single backslash in DataWeave 2.0?如何在 DataWeave 2.0 中获得单个反斜杠?
%dw 2.0
output application/json
---
{
"attempt1": "\String",
"attempt2": "\\String"
}
Returns:返回:
{
"attempt1": "\\String",
"attempt2": "\\String"
}
It appears it will always resolve to an even number if the output is in json like @machaval has said. 如果输出是@machaval所说的json,看来它将始终解析为偶数。
Tweaking mulesoft documentation: https://docs.mulesoft.com/mule-runtime/4.1/dataweave-language-introduction#examples 调整mulesoft文档: https ://docs.mulesoft.com/mule-runtime/4.1/dataweave-language-introduction#examples
%dw 2.0
output application/json
---
{
"a": "something",
"b": "dollar sign (\$)",
"c": 'single quote (\')',
"c": "double quote (\")",
"e": 'backtick (`)',
"f": "backslash(\)",
"g": "backslashOdd(\\\)",
"h": "backslashEven(\\\\\\)"
}
produces: 产生:
{
"a": "something",
"b": "dollar sign ($)",
"c": "single quote (')",
"c": "double quote (\")",
"e": "backtick (`)",
"f": "backslash(\\)",
"g": "backslashOdd(\\)",
"h": "backslashEven(\\\\)"
}
Favoriting this question in case you get a better answer. 如果您得到更好的答案,请偏爱此问题。 I think I ended up using toString().replace() in the past 我想我最终在过去使用了toString()。replace()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.