我正在尝试连接两个字符串。由于字符串名称包含.,因此不会在concat表达式中读取该特定字段。
json输入:
{
"properties": [
{
"test.flu": "flu1",
"reportId": 11
},
{
"test.flu": "flu2",
"reportId": 12
}
],
"type": "node",
"labels": "label1"
}jolt spec:
[
{
"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"
},
{
"test.flu": "flu2",
"reportId": 12,
"id": " 12"
}
],
"type": "node",
"labels": "label1"
}因为我连接的字符串有一个句点,所以它不会读取该字符串。我确信这将是一个非常小的修复。希望能得到一些帮助。
发布于 2020-12-19 05:30:37
您必须转义.字符才能更改其含义:
[
{
"operation": "modify-default-beta",
"spec": {
"properties": {
"*": {
"id": "=concat(@(1,test\\.flu),' ',@(1,reportId))"
}
}
}
}
]https://stackoverflow.com/questions/65363212
复制相似问题