我希望在JOLT中“externalId”字段位于“status”字段之前。
你知道为什么我在externalId之前得到状态吗?还有,我该如何更正它?
我希望输出中首先是Externalid,然后是status
/避免这段文字请
堆栈溢出是对许多代码说
低于
/
输入
{
"PURCHASE_ORDER_DISPATCH": {
"MsgData": {
"Transaction": {
"PO_POD_HDR_EVW1": {
"VENDOR_SETID": "WCOS",
"PO_ID": 25052,
"PO_POD_LN_EVW1": {
"WG_REQ_ID": 25694,
"PO_POD_SHP_EVW1": {
"FREIGHT_TERMS": "FOBDEST",
"BUSINESS_UNIT": "OFIC"
}
}
}
}
}
}
}
JOLT规格-
[
{
"operation": "shift",
"spec": {
"#UPSERT": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityHeader.action",
"*": {
"*": {
"*": {
"*": {
"PO_ID": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.externalId",
"#APPROVED": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.status",
"*": {
"WG_REQ_ID": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.poDescription",
"*": {
"FREIGHT_TERMS": "integration-inbound:IntegrationDetails.integrationEntities.integrationEntity.integrationEntityDetails.poDetails.poHeader.deliveryTermCode"
}
}
}
}
}
}
}
}
]
预期输出-
{
"integration-inbound:IntegrationDetails": {
"integrationEntities": {
"integrationEntity": {
"integrationEntityHeader": {
"action": "UPSERT"
},
"integrationEntityDetails": {
"poDetails": {
"externalId": 25052,
"status": "APPROVED",
"poHeader": {
"poDescription": 25694,
"deliveryTermCode": "FOBDEST"
}
}
}
}
}
}
}
新建输入
1条答案
按热度按时间erhoui1w1#
这正是您根据所需输出所希望的结果:
**注意:**如果你想根据你想要的东西来排序,你需要知道你不应该使用
*
来选择键。相反,你应该使用键的名称来获得它。就像你可以看到的顶级规范一样,我连续写了externalId
,status
,和poHeader
。但是我不明白为什么需要在JSON输出中对
externalId
和status
进行排序。**更新:**如果您的输出中有一个数组,您可以将以下规范添加到末尾,以防止出现相同值的数组。