Support Questions

Find answers, ask questions, and share your expertise

What is the JOLT transform for the provided input JSON object, and desired output JSON object?

My flow-file object looks like the following


{
  "trackInformation" : {
    "qualifiedAircraftId" : {
      "aircraftId" : "UAL894",
      "computerId" : {
        "facilityIdentifier" : "KZDC",
        "idNumber" : "35Y"
      },
      "gufi" : "KW59049300",
      "igtd" : "2019-04-09T18:15:00Z",
      "departurePoint" : {
        "airport" : "KIAD"
      },
      "arrivalPoint" : {
        "airport" : "KLAX"
      }
    },
    "speed" : 372,
    "reportedAltitude" : {
      "assignedAltitude" : {
        "simpleAltitude" : 254
      }
    },
    "position" : {
      "latitude" : {
        "latitudeDMS" : "MapRecord[{seconds=13, minutes=46, degrees=38, direction=NORTH}]"
      },
      "longitude" : {
        "longitudeDMS" : "MapRecord[{seconds=44, minutes=52, degrees=078, direction=WEST}]"
      }
    },
    "timeAtPosition" : "2019-04-09T18:28:53Z",
    "ncsmTrackData" : {
      "eta" : "MapRecord[{etaType=ESTIMATED, timeValue=2019-04-09T23:14:03Z}]",
      "rvsmData" : "MapRecord[{futureCompliance=true, equipped=true, currentCompliance=true}]",
      "arrivalFixAndTime" : "MapRecord[{fixName=HLYWD, arrTime=2019-04-09T22:53:03Z}]",
      "departureFixAndTime" : "MapRecord[{fixName=OTTTO, arrTime=2019-04-09T18:23:32Z}]",
      "nextEvent" : "MapRecord[{longitudeDecimal=-78.88557158170266, latitudeDecimal=38.76905063195677}]"
    }
  },
  "flightPlanAmendmentInformation" : null,
  "boundaryCrossingUpdate" : null,
  "ncsmFlightModify" : null
}


I need to remove the fields: flightPlanAmendmentInformation, boundaryCrossingUpdate, ncsmFlightModify. What is the spec that will allow me to do that?


I will then want to add a shift spec, so that fields like "speed" and "position" are at the top of the output . The ultimate desired output is as follows:


{
  "aircraftId": "UAL894",
  "facilityIdentifier": "KZDC",
  "gufi": "KW59049300",
  "igtd": "2019-04-09T18:15:00Z",
  "departure_airport": "KIAD",
  "arrival_airport": "KLAX",
  "speed": 372,
  "assignedAltitude": 254,
  "latitude": {
    "seconds": 13,
    "minutes": 46,
    "degrees": 38,
    "direction": "NORTH"
  },
  "longitude": {
    "seconds": 44,
    "minutes": 52,
    "degrees": 78,
    "direction": "WEST"
  },
  "timeAtPosition": "2019-04-09T18:28:53Z"
}
2 REPLIES 2

The following is what I have so far: The piece that I am struggling with is the "MapRecord" within latitudeDMS, and longitudeDMS


[
  {
    "operation": "shift",
    "spec": {
      "trackInformation": {
        "qualifiedAircraftId": {
          "aircraftId": "aircraftId",
          "computerId" : {
             "facilityIdentifier": "facilityIdentifier"
          },
          "departurePoint" : {
             "airport": "departure_airport"
          },
          "arrivalPoint" : {
             "airport": "arrival_airport"
          }
        },      
        "speed": "speed"
      }
    }
  }
]

Two other things I'm not sure how to do:

  1. Discard flowfile if "trackInformation": null
  2. eliminate leading 0 from an integer
Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.