使用 JOLT 传输 Json 输出时出现问题
Problem while Transferring Json output with JOLT
我遇到了以下问题:
我得到了一个 JSON 输入,例如
{
"Vorname":"Vorname1 Vorname2",
"Name":"Nachname
}
输出应该是:
{ "such":"NachnameVorname1Vorname2" }
我的 JOLT 规格是:
[{
"operation": "modify-default-beta",
"spec": {
"FullName": "=concat(@(1,Vorname),' ' ,@(1,Name))",
"RFullName": "=concat(@(1,Name),@(1,Vorname))"
}
}, {
"operation": "shift",
"spec": {
"PersNr": "ymitarb",
"Austrittsdatum": "ymaust",
"RFullName": "such",
"FullName": "name"
}
}, {
"operation": "default",
"spec": {
"name": "${fname}",
"such":"$(rfname)",
"ymitarb": "${nummer}"
}
}]
我得到的输出是:
{
"such": "NachnameVorname1 Vorname2",
"name": "Vorname1 Vorname2 Nachname",
"ymitarb": ""
}
虽然应该是 {"such":"NachnameVorname1Vorname2"}
我的第二个想法是将 Vorname 拆分为 Vorname_x
[{
"operation": "modify-default-beta",
"spec": {
"FullName": "=concat(@(1,Vorname),' ' ,@(1,Name))",
"RFullName": "=concat(@(1,Name),@(1,Vorname))"
}
}, {
"operation": "shift",
"spec": {
"Vorname": {
"* * *": {
"$(0,1)": "Vorname_1",
"$(0,2)": "Vorname_2",
"$(0,3)": "Vorname_3"
},
"* *": {"$(0,1)": "Vorname_1",
"$(0,2)": "Vorname_2"}
},
"PersNr": "ymitarb",
"Austrittsdatum": "ymaust",
"RFullName": "such",
"FullName": "name"
}
}, {
"operation": "default",
"spec": {
"name": "${fname}",
"such":"$(rfname)",
"ymitarb": "${nummer}"
}
}]
这里的输出是:
{
"Vorname_1": "Vorname1",
"Vorname_2": "Vorname2",
"such": "NachnameVorname1 Vorname2",
"name": "Vorname1 Vorname2 Nachname",
"ymitarb": ""
}
我无法在 concat 中使用 Vorname_1 和 Vorname_2 的值......
因为我找不到任何解决方案
规格
[
{
"operation": "shift",
"spec": {
// split Vorname by a space
"Vorname": {
"* *": {
"$(0,1)": "vorFront",
"$(0,2)": "vorBack"
}
},
// pass Name thru
"Name": "Name"
}
},
{
"operation": "modify-default-beta",
"spec": {
// concat the names now that the space is gone
"such": "=concat(@(1,Name),@(1,vorFront),@(1,vorBack))"
}
}
]
我遇到了以下问题: 我得到了一个 JSON 输入,例如
{
"Vorname":"Vorname1 Vorname2",
"Name":"Nachname
}
输出应该是:
{ "such":"NachnameVorname1Vorname2" }
我的 JOLT 规格是:
[{
"operation": "modify-default-beta",
"spec": {
"FullName": "=concat(@(1,Vorname),' ' ,@(1,Name))",
"RFullName": "=concat(@(1,Name),@(1,Vorname))"
}
}, {
"operation": "shift",
"spec": {
"PersNr": "ymitarb",
"Austrittsdatum": "ymaust",
"RFullName": "such",
"FullName": "name"
}
}, {
"operation": "default",
"spec": {
"name": "${fname}",
"such":"$(rfname)",
"ymitarb": "${nummer}"
}
}]
我得到的输出是:
{
"such": "NachnameVorname1 Vorname2",
"name": "Vorname1 Vorname2 Nachname",
"ymitarb": ""
}
虽然应该是 {"such":"NachnameVorname1Vorname2"}
我的第二个想法是将 Vorname 拆分为 Vorname_x
[{
"operation": "modify-default-beta",
"spec": {
"FullName": "=concat(@(1,Vorname),' ' ,@(1,Name))",
"RFullName": "=concat(@(1,Name),@(1,Vorname))"
}
}, {
"operation": "shift",
"spec": {
"Vorname": {
"* * *": {
"$(0,1)": "Vorname_1",
"$(0,2)": "Vorname_2",
"$(0,3)": "Vorname_3"
},
"* *": {"$(0,1)": "Vorname_1",
"$(0,2)": "Vorname_2"}
},
"PersNr": "ymitarb",
"Austrittsdatum": "ymaust",
"RFullName": "such",
"FullName": "name"
}
}, {
"operation": "default",
"spec": {
"name": "${fname}",
"such":"$(rfname)",
"ymitarb": "${nummer}"
}
}]
这里的输出是:
{
"Vorname_1": "Vorname1",
"Vorname_2": "Vorname2",
"such": "NachnameVorname1 Vorname2",
"name": "Vorname1 Vorname2 Nachname",
"ymitarb": ""
}
我无法在 concat 中使用 Vorname_1 和 Vorname_2 的值...... 因为我找不到任何解决方案
规格
[
{
"operation": "shift",
"spec": {
// split Vorname by a space
"Vorname": {
"* *": {
"$(0,1)": "vorFront",
"$(0,2)": "vorBack"
}
},
// pass Name thru
"Name": "Name"
}
},
{
"operation": "modify-default-beta",
"spec": {
// concat the names now that the space is gone
"such": "=concat(@(1,Name),@(1,vorFront),@(1,vorBack))"
}
}
]