mutability / dump1090

Dump1090 is a simple Mode S decoder for RTLSDR devices
528 stars 137 forks source link

Altitude in JSON output can be number or string variable #239

Closed marcus-aa closed 5 years ago

marcus-aa commented 5 years ago

Parsing the altitude from aircraft.json is complicated by changing from a number to a string when "on ground" is indicated.

For example, VRS can not accept the data field in it's json input.

Not a bug per se, but not "best practice" either.

Examples:

"altitude": 37000, "altitude": "ground",

~# cat /run/dump1090-mutability/aircraft.json | jq '.aircraft[] | .altitude' 23550 34975 39000 35025 33000 37000 25425 "ground"

ab1jx commented 5 years ago

I think that's a general shortcoming of javascript, I've run into it before in a different scenario. The advice I got was to do something with no effect to it as a number if you want it to be a number, like multiply it by 1 or add 0 to it.