问题描述
我正在尝试连接两个字符串。由于字符串名称包含 .
,因此不会在 concat 表达式中读取该特定字段。
json 输入:
{
"properties": [
{
"test.flu": "flu1","reportId": 11
},{
"test.flu": "flu2","reportId": 12
}
],"type": "node","labels": "label1"
}
震动规格:
[
{
"operation": "modify-default-beta","spec": {
"properties": {
"*": {
"id": "=concat(@(1,test.flu),' ',@(1,reportId))"
}
}
}
}
]
输出:
{
"properties": [
{
"test.flu": "flu1","reportId": 11,"id": " 11" // expected output: "flu1 11"
},"reportId": 12,"id": " 12"
}
],"labels": "label1"
}
由于我的连接字符串有一个句点,它不会读取该字符串。我相信这将是非常小的修复。期待获得帮助。
解决方法
您必须转义 .
字符才能更改其含义:
[
{
"operation": "modify-default-beta","spec": {
"properties": {
"*": {
"id": "=concat(@(1,test\\.flu),' ',@(1,reportId))"
}
}
}
}
]