Given a CSV Input file with Headers:
"CorrelationID", "Message", "EventTimeStamp", "Flag", "RandomColumns"
12345, "Hello", "2019-06-09 04:25:15", "True", "blah"
12345, "Hello", "2019-06-09 04:25:18", "False", "blah"
45678, "Brick", "2019-06-09 04:26:23", "True", "blah"
78912, "Stone", "2019-06-09 04:29:50", "False", "blah"
Consider only those CorrelationID which has both true and false Flag. Ignore the rest of rows which don't contain both "true" and "false" value for "flag" column
EventTimeStamp value for True flag goes as StartTime and EventTimeStamp value for False flag goes as EndTime
JSON file format as Output:
{"CorrelationID": "12345","Message":"Hello","StartTime":"2019-06-09 04:25:15","EndTime":"2019-06-09 04:25:18"}