Json 数组的 JOLT 变换规范表达式
Spec Expression for JOLT transform of Json Array
我有一个输入 json,其格式为:
{
"ListArray": [
{
"address": "address1",
"contact": "123456789",
"bpId": 123
},
{
"address": "address2",
"contact": "135792468",
"bpId": 456
},
{
"address": "address3",
"contact": "246812356",
"bpId": 678
}
]
}
我希望输出 json 采用这种格式:
{
"Address_list": ["address1","address2","address3"],
"Contact_list": ["123456789","135792468","246812356"],
"Id_list": [123,456,678]
}
有人能告诉我应该怎么做吗? jolt变换表达式应该是什么
使用一步shift类型转换就够了如
[
{
"operation": "shift",
"spec": {
"ListArray": {
"*": {
"address": "Address_list",
"contact": "Contact_list",
"bpId": "Id_list"
}
}
}
}
]
如果不是改键名,直接这样用
[
{
"operation": "shift",
"spec": {
"ListArray": {
"*": {
"*": "&"
}
}
}
}
]
我有一个输入 json,其格式为:
{
"ListArray": [
{
"address": "address1",
"contact": "123456789",
"bpId": 123
},
{
"address": "address2",
"contact": "135792468",
"bpId": 456
},
{
"address": "address3",
"contact": "246812356",
"bpId": 678
}
]
}
我希望输出 json 采用这种格式:
{
"Address_list": ["address1","address2","address3"],
"Contact_list": ["123456789","135792468","246812356"],
"Id_list": [123,456,678]
}
有人能告诉我应该怎么做吗? jolt变换表达式应该是什么
使用一步shift类型转换就够了如
[
{
"operation": "shift",
"spec": {
"ListArray": {
"*": {
"address": "Address_list",
"contact": "Contact_list",
"bpId": "Id_list"
}
}
}
}
]
如果不是改键名,直接这样用
[
{
"operation": "shift",
"spec": {
"ListArray": {
"*": {
"*": "&"
}
}
}
}
]