我有以下JSON输入,我希望使用Jolt进行转换:
{
"data": {
"tests": [
{
"id": 304674,
"name": "Test Number One",
"description": "First Test"
},
{
"id": 12345,
"name": "Test Number Two",
"description": "Second test"
}
]
}
}
我希望输出重命名一些内容,然后添加一个名为Locations的新数组,从而产生以下所需的输出:
{
"data": {
"tests": [
{
"TestID": 304674,
"Name": "Test Number One",
"Description": "First Test",
"locations": [
"Paris",
"London"
],
},
{
"id": 12345,
"name": "Test Number Two",
"description": "Second test",
"locations": [
"Paris",
"London"
],
}
]
}
}
我在apache-nifi上try 了以下jolt规范,但当我运行它时,我只能得到位置的"paris".
[
{
"operation": "shift",
"spec": {
"data": {
"tests": {
"*": {
"id": "data.tests[&1].TestID",
"name": "data.tests[&1].Name",
"description": "data.tests[&1].Description"
}
}
}
}
},
{
"operation": "modify-default-beta",
"spec": {
"data": {
"tests": {
"*": {
"locations": ["Paris", "London"]
}
}
}
}
}
]