如何在JOLT中附加额外的字段列表?
问题描述:
我想添加一些额外的字段到列表中没有在输入json中。如果它是一个对象,我可以添加字段,但是我无法将这些字段添加到数组中。请有人帮我写一个规范。如何在JOLT中附加额外的字段列表?
input JOSN is:
[
{
"List": [
{
"ITEM_NO": "abcd"
}
]
}
]
写了一个规范文件
SPEC File is:
[
{
"operation": "shift",
"spec": {
"*": {
"List": {
"0": {
"ITEM_NO": "risk[0].one"
}
}
}
}
},
{
"operation": "default",
"spec": {
"risk": [{
"two": "efgh",
"three":"ijkl"
}]
}
}
]
但输出不喜欢有望
expeted output is:
{
"risk" : [ {
"one" : "abcd",
"two":"efgh",
"three":"ijkl"
} ]
}
如何添加字段?
答
规格
[
{
"operation": "shift",
"spec": {
"*": {
"List": {
"0": {
"ITEM_NO": "risk[0].one"
}
}
}
}
},
{
"operation": "default",
"spec": {
"risk[]": {
"0": {
"two": "efgh",
"three": "ijkl"
}
}
}
}
]
可生产你想要的输出,但不知道你正在尝试做的。
+0
谢谢你的工作。 –
您好,我正在寻找这个问题的答案。请帮助我。提前致谢。 –