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.

1 Answer 1

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"
        }
      }
    }
  }
]
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the response. However i want to insert that attribute right after "Passenger" array. Would that be possible at all using Jolt?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.