震动转换问题分开记录
我正在尝试将记录的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"
}...
I'm trying to transform a record json into individual json records but have a hard time getting the values rather than the names. I expect the keys to change on occasion and there to be more than 4 records on occasion so I wanted it to be dynamic. It seems the current transform will only give me the keys and not the values broken out into there own records.
Input
[
{
"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"
}
}
]
Current Transformation
[
{
"operation": "shift",
"spec": {
"*": {
"*": {
"Owner": "Owner.[].@(1,0)",
"quot;: "&",
"@": "@clientId"
}
}
}
}
]
Im Getting
{
"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"
}
But wanting
{
"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"
}...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
$
不需要通配符,但仅使用@
通配符就足够了,以及用 0 和1
(0 | 1
),例如使用
[& ]。
将每个数组转换为单个数组中的分开对象。如果您需要将所有对象放入数组中,请用
“ 0 | 1”
用“*”*“*”
通配符。$
wildcard is not needed, but only using@
wildcard is enough, along with filtering by indices with0
and1
(0|1
) such aswhere prepending the value with
[&].
converts each individual array to seperate objects within a single array.If you need to get all the objects within the array, then replace
"0|1"
with"*"
wildcard.