Jolt Transformation 打破记录的问题
Jolt Transformation issue breaking apart records
我正在尝试将记录 json 转换为单独的 json 记录,但很难获得值而不是名称。我希望密钥有时会更改,有时会有超过 4 条记录,所以我希望它是动态的。似乎当前的转换只会给我键,而不是分解成自己记录的值。
输入
[
{
"Owner": {
"0": "CIMections",
"1": "CIMections",
"2": "CIMections",
"3": "CIMections"
},
"Name": {
"0": "AFE 20NSF044",
"1": "AFE 20NSF044",
"2": "AFE 20NSF044",
"3": "AFE 20NSF044"
},
"Producer": {
"0": "Produtream",
"1": "Produtream",
"2": "Produtream",
"3": "Produtream"
},
"Producers ID": {
"0": "NTI XR 001-004",
"1": "NTI XR 001-004",
"2": "NTI XR 001-004",
"3": "NTI XR 001-004"
},
"Weld - Real Time Count": {
"0": "",
"1": "",
"2": "",
"3": ""
},
"Character Set": {
"0": "ISO_IR 192",
"1": "ISO_IR 192",
"2": "ISO_IR 192",
"3": "ISO_IR 192"
},
"inv# Welds": {
"0": "Accepted 001",
"1": "Accepted 002",
"2": "Accepted 003",
"3": "Accepted 004"
},
"invoice": {
"0": 893300361,
"1": 411904740,
"2": 673190473,
"3": 1426231494
},
"status": {
"0": "Done",
"1": "Done",
"2": "Done",
"3": "Done"
},
"Date Completed": {
"0": "20210301 163500.000000",
"1": "20210301 163500.000000",
"2": "20210301 163500.000000",
"3": "20210301 163500.000000"
},
"Institution Name": {
"0": "NXXT Digital",
"1": "NXXT Digital",
"2": "NXXT Digital",
"3": "NXXT Digital"
},
"file_id": {
"0": "00001",
"1": "00002",
"2": "00003",
"3": "00004"
}
}
]
当前转换
[
{
"operation": "shift",
"spec": {
"*": {
"*": {
"Owner": "Owner.[].@(1,0)",
"$": "&",
"@": "@clientId"
}
}
}
}
]
我正在接受
{
"Owner" : "Owner",
"Name" : "Name",
"Producer" : "Producer",
"Producers ID" : "Producers ID",
"Weld - Real Time Count" : "Weld - Real Time Count",
"Character Set" : "Character Set",
"inv# Welds" : "inv# Welds",
"invoice" : "invoice",
"status" : "status",
"Date Completed" : "Date Completed",
"Institution Name" : "Institution Name",
"file_id" : "file_id"
}
但是想要
{
"Owner" : "CIMections",
"Name" : "AFE 20NSF044",
"Producer" : "Produtream",
"Producers ID" : "NTI XR 001-004",
"Weld - Real Time Count" : "",
"Character Set" : "ISO_IR 192",
"inv# Welds" : "Accepted 001",
"invoice" : "893300361",
"status" : "Done",
"Date Completed" : "20210301 163500.000000",
"Institution Name" : "NXXT Digital",
"file_id" : "00001"
},
{
"Owner" : "CIMections",
"Name" : "AFE 20NSF044",
"Producer" : "Produtream",
"Producers ID" : "NTI XR 001-004",
"Weld - Real Time Count" : "",
"Character Set" : "ISO_I 192",
"inv# Welds" : "Accepted 002",
"invoice" : "411904740",
"status" : "Done",
"Date Completed" : "20210301 163500.000000",
"Institution Name" : "NXXT Digital",
"file_id" : "00002"
}...
不需要 $
通配符,但仅使用 @
通配符就足够了,同时使用 0
和 1
(0|1
) 如
[
{
"operation": "shift",
"spec": {
"*": {
"*": {
"0|1": {
"@": "[&].&2"
}
}
}
}
}
]
在值前面加上 [&].
将每个单独的数组转换为单个数组中的单独对象。
如果需要获取数组中的所有对象,则将"0|1"
替换为"*"
通配符。
我正在尝试将记录 json 转换为单独的 json 记录,但很难获得值而不是名称。我希望密钥有时会更改,有时会有超过 4 条记录,所以我希望它是动态的。似乎当前的转换只会给我键,而不是分解成自己记录的值。
输入
[
{
"Owner": {
"0": "CIMections",
"1": "CIMections",
"2": "CIMections",
"3": "CIMections"
},
"Name": {
"0": "AFE 20NSF044",
"1": "AFE 20NSF044",
"2": "AFE 20NSF044",
"3": "AFE 20NSF044"
},
"Producer": {
"0": "Produtream",
"1": "Produtream",
"2": "Produtream",
"3": "Produtream"
},
"Producers ID": {
"0": "NTI XR 001-004",
"1": "NTI XR 001-004",
"2": "NTI XR 001-004",
"3": "NTI XR 001-004"
},
"Weld - Real Time Count": {
"0": "",
"1": "",
"2": "",
"3": ""
},
"Character Set": {
"0": "ISO_IR 192",
"1": "ISO_IR 192",
"2": "ISO_IR 192",
"3": "ISO_IR 192"
},
"inv# Welds": {
"0": "Accepted 001",
"1": "Accepted 002",
"2": "Accepted 003",
"3": "Accepted 004"
},
"invoice": {
"0": 893300361,
"1": 411904740,
"2": 673190473,
"3": 1426231494
},
"status": {
"0": "Done",
"1": "Done",
"2": "Done",
"3": "Done"
},
"Date Completed": {
"0": "20210301 163500.000000",
"1": "20210301 163500.000000",
"2": "20210301 163500.000000",
"3": "20210301 163500.000000"
},
"Institution Name": {
"0": "NXXT Digital",
"1": "NXXT Digital",
"2": "NXXT Digital",
"3": "NXXT Digital"
},
"file_id": {
"0": "00001",
"1": "00002",
"2": "00003",
"3": "00004"
}
}
]
当前转换
[
{
"operation": "shift",
"spec": {
"*": {
"*": {
"Owner": "Owner.[].@(1,0)",
"$": "&",
"@": "@clientId"
}
}
}
}
]
我正在接受
{
"Owner" : "Owner",
"Name" : "Name",
"Producer" : "Producer",
"Producers ID" : "Producers ID",
"Weld - Real Time Count" : "Weld - Real Time Count",
"Character Set" : "Character Set",
"inv# Welds" : "inv# Welds",
"invoice" : "invoice",
"status" : "status",
"Date Completed" : "Date Completed",
"Institution Name" : "Institution Name",
"file_id" : "file_id"
}
但是想要
{
"Owner" : "CIMections",
"Name" : "AFE 20NSF044",
"Producer" : "Produtream",
"Producers ID" : "NTI XR 001-004",
"Weld - Real Time Count" : "",
"Character Set" : "ISO_IR 192",
"inv# Welds" : "Accepted 001",
"invoice" : "893300361",
"status" : "Done",
"Date Completed" : "20210301 163500.000000",
"Institution Name" : "NXXT Digital",
"file_id" : "00001"
},
{
"Owner" : "CIMections",
"Name" : "AFE 20NSF044",
"Producer" : "Produtream",
"Producers ID" : "NTI XR 001-004",
"Weld - Real Time Count" : "",
"Character Set" : "ISO_I 192",
"inv# Welds" : "Accepted 002",
"invoice" : "411904740",
"status" : "Done",
"Date Completed" : "20210301 163500.000000",
"Institution Name" : "NXXT Digital",
"file_id" : "00002"
}...
$
通配符,但仅使用 @
通配符就足够了,同时使用 0
和 1
(0|1
) 如
[
{
"operation": "shift",
"spec": {
"*": {
"*": {
"0|1": {
"@": "[&].&2"
}
}
}
}
}
]
在值前面加上 [&].
将每个单独的数组转换为单个数组中的单独对象。
如果需要获取数组中的所有对象,则将"0|1"
替换为"*"
通配符。