0

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.

Despicable me
  • 548
  • 1
  • 9
  • 24

1 Answers1

1

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"
        }
      }
    }
  }
]
Milo S
  • 4,466
  • 1
  • 19
  • 22
  • Thanks for the response. However i want to insert that attribute right after "Passenger" array. Would that be possible at all using Jolt? – Despicable me Nov 27 '18 at 17:38