0
votes

My sample json looks like this


    {  
       "Event":{  
          "EventHeader":{  
             "size":57,
             "eventTime":"2018-11-02T20:31:15.428"
          },
          "EventData":{  
             "record":"XXXXX",
             "time":"201805270343",
             "count":11,
             "passengers":[  
                {  
                   "name":"DOE/JOHN",
                   "details":{  
                      "genderCode":"M",
                      "birthDate":"19900502",
                      "personName":{  
                         "lastName":"DOE",
                         "firstName":"JOHN",
                         "middleName":null
                      }
                   }
                }
             ],
             "flightCount":0,
             "ticketed":{  
                "typeCode":null,
                "comments":"ABCD"
             },
             "telephoneCnt":0
          }
       }
    }
and the desired  output look like this 

 <pre>{  
   "Event":{  
      "EventHeader":{  
         "size":57,
         "eventTime":"2018-11-02T20:31:15.428"
      },
      "EventData":{  
         "record":"XXXXX",
         "time":"201805270343",
         "count":11,
         "passengers":[  
            {  
               "name":"DOE/JOHN",
               "details":{  
                  "genderCode":"M",
                  "birthDate":"19900502",
                  "personName":{  
                     "lastName":"DOE",
                     "firstName":"JOHN",
                     "middleName":null
                  }
               }
            }
         ],
         "paxend":"true",
         "flightCount":0,
         "ticketed":{  
            "typeCode":null,
            "comments":"ABCD"
         },
         "telephoneCnt":0
      }
   }
}

Basically i want to add "paxend": "true" right after the Passenger array. How can we achieve this using Jolt? Any help greatly appreciated.I am sorry for not posting my jolt spec since it is not working.

1

1 Answers

1
votes

So this will add "paxend": "true" to the EventData, but there is no Out of The Box way to put it right "below" the "passengers" array. It is a JSON map, the order specifically should not matter.

Spec

[
  {
    "operation": "default",
    "spec": {
      "Event": {
        "EventData": {
          "paxend": "true"
        }
      }
    }
  }
]