Created 05-08-2023 06:40 AM
For the below given input, how do i move the name value pairs(installDate and status) to the upper level
{
"header": {
"version": "1.0",
"timeStamp": "1670484663189",
"activityId": "256388257993155783",
"action": "create",
"refreshId": "null"
},
"resource": {
"drniId": "256383859946641699",
"@type": "LogicalCrossConnection",
"subtype": "Backplane Connection",
"name": "Backplane Connection",
"resourceCharacteristic": [
{
"name": "tmf639_dataSource_ingestion_uuid",
"value": "256383859946641699",
"@type": "string"
},
{
"name": "p16Latest",
"value": true,
"@type": "boolean"
},
{
"name": "installDate",
"value": "202303323",
"@type": "string"
},
{
"name": "status",
"value": "In Service",
"@type": "string"
}
],
"resourceRelationship": [
{
"drniId": "256387639517862117",
"@type": "LogicalInterface:HAS_CONNECTION_COMPONENT:OUT",
"subtype": "ODU2e",
"name": "ODU2e.1-8",
"relationDrniId": "256383859946641700",
"resourceRelationshipCharacteristic": [
{
"name": "p16Latest",
"value": true,
"@type": "boolean"
},
{
"name": "sectionNumber",
"value": 0,
"@type": "long"
},
{
"name": "p3CreateActivity",
"value": 256388257993155780,
"@type": "long"
},
{
"name": "isNotInRoute",
"value": "N",
"@type": "string"
},
{
"name": "p2Create",
"value": 1670480203578,
"@type": "long"
},
{
"name": "seq",
"value": 1,
"@type": "long"
}
]
},
{
"drniId": "256383859946641335",
"@type": "LogicalInterface:HAS_CONNECTION_COMPONENT:OUT",
"subtype": "ODU2e",
"name": "ODU2e.1-8",
"relationDrniId": "256383859946641701",
"resourceRelationshipCharacteristic": [
{
"name": "p16Latest",
"value": true,
"@type": "boolean"
},
{
"name": "sectionNumber",
"value": 0,
"@type": "long"
},
{
"name": "p3CreateActivity",
"value": 256388257993155780,
"@type": "long"
},
{
"name": "isNotInRoute",
"value": "N",
"@type": "string"
},
{
"name": "latest",
"value": [
2,
3,
16
],
"@type": "array"
}
]
}
]
}
}
Expected Output
{
"records" : {
"inv_activity_ts" : "1670484663189",
"inv_activity_id" : "256388257993155783",
"action" : "create",
"inv_id" : "256383859946641699",
"inv_subtype" : "Backplane Connection",
"inv_name" : "Backplane Connection",
"installDate" : "202303323",
"status" : "status"
}
}
@SAMSAL Any help you could provide?
Created 05-08-2023 07:58 AM
Hi,
See if this helps:
[
{
"operation": "shift",
"spec": {
"header": {
"timeStamp": "records.inv_activity_ts",
"activityId": "records.inv_activity_id",
"action": "records.action"
},
"resource": {
"drniId": "records.inv_id",
"subtype": "records.inv_subtype",
"name": "records.inv_name",
"resourceCharacteristic": {
"*": {
"name": {
"status": {
"$": "records.status",
"@(2,value)": "records.matchingStatus_value"
},
"installDate": {
"@(2,value)": "records.installDate"
}
}
}
}
}
}
}
]
If that helps please accept solution.
Thanks
Created 05-08-2023 09:20 AM
i have slightly modifed the spec as. The matchingStatus_value doesn't provide the right result
[{
"operation": "shift",
"spec": {
"header": {
"timeStamp": "records.inv_activity_ts",
"activityId": "records.inv_activity_id",
"action": "records.action"
},
"resource": {
"drniId": "records.inv_id",
"subtype": "records.inv_subtype",
"name": "records.inv_name",
"resourceCharacteristic": {
"*": {
"name": {
"tmf639_dataSource_ingestion_uuid": {
"@(2,value)": "records.tmf639_dataSource_ingestion_uuid"
},
"createdDate": {
"@(2,value)": "records.createdDate"
},
"lastModifiedDate": {
"@(2,value)": "records.lastModifiedDate"
},
"status": {
"@(2,value)": "records.status"
}
}
}
}
}
}
}]
Is this a valid one?
Created 05-08-2023 09:47 AM
if what you provided seems to be giving you the expected output then you are good to go :).