FlightAware Discussions

Received improper JSON flight alert through API

Hello

I configured a flight alert rule for a flight. As per documentation, flightxml should be submiting a valid json to the end point. However I received the below payload as alert. This seems to be a javascript code, and not a valid JSON format. Since the end point is Function based, the reception fails due to incorrect payload. Is there a problem in alert setup? Any help is appreciated.

{ long_desc: ‘IndiGo #6052 (A320) departed Thiruvananthapuram Int’l (TRV) at 12:59PM IST enroute to Indira Gandhi Int’l (DEL) for an estimated arrival at 03:54PM IST\n\nDestination (Indira Gandhi Int’l / DEL): Terminal 1D’,
short_desc: ‘IGO6052 (A320) departed TRV @ 12:59PM IST for DEL ETA 03:54PM IST’,
summary: ‘IGO6052 has departed TRV for DEL’,
eventcode: ‘departure’,
alert_id: 32855315,
flight:
{ ident: ‘IGO6052’,
aircrafttype: ‘A320’,
origin: ‘VOTV’,
destination: ‘VIDP’,
filed_ete: ‘02:55:00’,
route: ‘’,
faFlightID: ‘IGO6052-1577079919-airline-0562’,
reg: ‘VTIHX’,
filed_altitude: 0,
filed_airspeed_kts: 414,
filed_time: 1577255784,
filed_departuretime: 1577259300,
estimatedarrivaltime: 1577269453,
actualarrivaltime: 0,
actualdeparturetime: 1577258953,
estimated_blockin_time: 1577269920,
filed_blockin_time: 1577270400,
actual_blockin_time: 0,
estimated_blockout_time: 1577258220,
filed_blockout_time: 1577258700,
actual_blockout_time: 1577258220,
filed_arrivaltime: 1577269800 } }

Thanks in advance

That appears to be legal and properly formed JSON to me. What aspect of it do you believe is unsupported by the JSON standard? https://www.json.org/json-en.html

Hello Bovineone,

Thank you for your reply. The above mentioned cannot be parsed as the keys and strings are not properly double quoted.

The link also mentions " A string is a sequence of zero or more Unicode characters, wrapped in double quotes, using backslash escapes. A character is represented as a single character string. "

Verifying the above json fails in any online json validator.

below are few valid examples as per IETF RFC spec
https://tools.ietf.org/html/rfc7159#page-12

I expected the out come to be like below

{
“long_desc”: “IndiGo #6052 (A320) departed Thiruvananthapuram Int’l (TRV) at 12:59PM IST enroute to Indira Gandhi Int’l (DEL) for an estimated arrival at 03:54PM IST\n\nDestination (Indira Gandhi Int’l / DEL): Terminal 1D”,
“short_desc”: “IGO6052 (A320) departed TRV @ 12:59PM IST for DEL ETA 03:54PM IST”,
“summary”: “IGO6052 has departed TRV for DEL”,
“eventcode”: “departure”,
“alert_id”: 32855315,
“flight”: {
“ident”: “IGO6052”,
“aircrafttype”: “A320”,
“origin”: “VOTV”,
“destination”: “VIDP”,
“filed_ete”: “02:55:00”,
“route”: “”,
“faFlightID”: “IGO6052-1577079919-airline-0562”,
“reg”: “VTIHX”,
“filed_altitude”: 0,
“filed_airspeed_kts”: 414,
“filed_time”: 1577255784,
“filed_departuretime”: 1577259300,
“estimatedarrivaltime”: 1577269453,
“actualarrivaltime”: 0,
“actualdeparturetime”: 1577258953,
“estimated_blockin_time”: 1577269920,
“filed_blockin_time”: 1577270400,
“actual_blockin_time”: 0,
“estimated_blockout_time”: 1577258220,
“filed_blockout_time”: 1577258700,
“actual_blockout_time”: 1577258220,
“filed_arrivaltime”: 1577269800
}
}

Thanks for your support in advance!

I think there might be some re-formatting occurring on your side, since I’m not seeing single-quotes used on strings in my own testing. (For example, our output is not pretty-printed onto multiple lines.)

{"long_desc":"JetBlue #201 flight information has changed\n  Departure Gate is now 25\n\nFlight Status: Scheduled\n\nDeparture:\n  John F Kennedy Intl (JFK)\n  Sat 17-Aug-2019 12:36PM EDT\n  Terminal 5, Gate 25\n\nArrival:\n  Fort Lauderdale Intl (FLL)\n  Sat 17-Aug-2019 03:50PM EDT\n  Terminal 3, Gate F7\n\n","short_desc":"JetBlue #201 flight information has changed\n  Departure Gate is now 25\n\n","summary":"JBU201 flight information has changed","eventcode":"change","alert_id":22657765,"flight":{"ident":"JBU201","aircrafttype":"A320","origin":"KJFK","destination":"KFLL","filed_ete":"02:54:00","route":"SHIPP JETZZ BLUUU DUMPR ICCEY OHRYN BEHHR WEBBB HOBOH PAEPR M201 HANRI M201 BAHAA AR21 CRANS FISEL7","faFlightID":"JBU201-1565844376-airline-0349","reg":"N821JB","filed_altitude":340,"filed_airspeed_kts":320,"filed_time":1565844376,"filed_departuretime":1566060360,"estimatedarrivaltime":1566070800,"actualarrivaltime":0,"actualdeparturetime":0,"estimated_blockin_time":1566071400,"filed_blockin_time":1566071400,"actual_blockin_time":0,"estimated_blockout_time":1566059760,"filed_blockout_time":1566059760,"actual_blockout_time":0,"filed_arrivaltime":1566070800}}