Hello,
I have a json input for which I need to add one key-value("correlationId": "123456789") under 'tripSummaryMetaData' section dynamically.
I tried with below spec and its working fine, but the issues is when 'tripSummaryMetaData' is not available the it is creating new 'tripSummaryMetaData' and adding my attribute.
When 'tripSummaryMetaData' is not available the it should not add my new attribute, is that possible in JOLT?
Thanks in advance.
Input:
{
"tripSummaryMetaData": {
"orgId": "demo",
"message_type_id": "MB-CD-MSG0001"
},
"eventSummary": {
"tripId": "2018072204cc7851d3e84f7ea8a1155c95f65b06",
"referenceData": "050bfa62-430a-45a5-b7a6-78d688d45167",
"gpsData": [{
"gpsTimeReceived": 1532319157338,
"gpsTime": "2018-07-22T21:12:38-07:00"
}]
}
}
Output:
{
"tripSummaryMetaData" : {
"orgId" : "demo",
"message_type_id" : "MB-CD-MSG0001",
"correlationId" : "123456789"
},
"eventSummary" : {
"tripId" : "2018072204cc7851d3e84f7ea8a1155c95f65b06",
"referenceData" : "050bfa62-430a-45a5-b7a6-78d688d45167",
"gpsData" : [ {
"gpsTimeReceived" : 1532319157338,
"gpsTime" : "2018-07-22T21:12:38-07:00"
} ]
}
}
Spec :
[{
"operation": "default",
"spec": {
"tripSummaryMetaData": {
"correlationId": "123456789"
}
}
}]
Thanks,
Mahendra