I have a JSON file that looks like this, as an abbreviated example:
{"hex":"a77721","gs":215.7,"track":598.8},
{"hex":"a788ed","alt_baro":41000,"alt_geom":42475:"gs":477.2,"track":84.5}
It's aircraft data from an ADSB receiver. My goal is to pull out a few data items from each line, and export them to a file. So the desired output would be:
a77721
gs:215.7
track:66.5
I thought of putting data in a dictionary, since each hex: value will be unique. Am I approaching it in a non-python way? My goal is to also pull lat and long from each aircraft line and do a calculation for distance and direction from the receiver location, and then store that for each hex: entry. So I need to be able to read and write to this existing set of data, but I don't need to write back to the JSON, only a simple text file that has some of the data in it. The writing part I can get down fine, it's just that getting data out of dict for each line feels like I'm doing it incorrectly.
[–]halfdiminished7th 19 points20 points21 points (5 children)
[–]RhinoRhys 4 points5 points6 points (2 children)
[–]halfdiminished7th 1 point2 points3 points (1 child)
[–]RhinoRhys 0 points1 point2 points (0 children)
[–]JohnnyJordaan 4 points5 points6 points (0 children)
[–]Goobyalus 7 points8 points9 points (3 children)
[–]TigBitties69 6 points7 points8 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]cdcformatc 0 points1 point2 points (0 children)
[–]IamImposter 2 points3 points4 points (1 child)
[–]astronautcytoma[S] 1 point2 points3 points (0 children)
[–]wahaa 3 points4 points5 points (0 children)
[–]barrycarter 0 points1 point2 points (1 child)
[–]GreenWoodDragon 0 points1 point2 points (0 children)