So yeah - I used:
# convert data to json
data_json = json.loads(data)
print (data)
To just get all of the raw json into my logging solution - problem is - I really like the name pair break out - it’s just that I can’t use the raw JSON as is (in my tools):
[[1612551064,0,0.49,1.3,123,3,986.52,8.89,38.61,70754,4.31,590,0,0,0,0,2.442,1]]
To create name pairs. What I’m trying to get close to is how the API returns data (just live from UDP):
{"timestamp":1612551124,"air_temperature":8.9,"barometric_pressure":986.4,"station_pressure":986.4,"sea_level_pressure":1009.6,"relative_humidity":38,"precip":0,"precip_accum_last_1hr":0,"precip_accum_local_day":0,"precip_accum_local_yesterday":0.072504,"precip_accum_local_yesterday_final":2.654446,"precip_minutes_local_day":0,"precip_minutes_local_yesterday":1,"precip_minutes_local_yesterday_final":1,"precip_analysis_type_yesterday":1,"wind_avg":0.6,"wind_direction":265,"wind_gust":1.9,"wind_lull":0,"solar_radiation":433,"uv":3.38,"brightness":51937,"lightning_strike_count":0,"lightning_strike_count_last_1hr":0,"lightning_strike_count_last_3hr":0,"feels_like":8.9,"heat_index":8.9,"wind_chill":8.9,"dew_point":-4.7,"wet_bulb_temperature":3.5,"delta_t":5.4,"air_density":1.21831,"pressure_trend":"steady"}
Which is totally usable!
This kind of output:
{‘Datetime’: datetime.datetime(2021, 2, 5, 14, 14, 3),
(‘Time Epoch’, ‘Seconds’): 1612556043,
(‘Wind Direction’, ‘Degrees’): 339,
(‘Wind Speed’, ‘m/s’): 0.89}
would be okay - but it’s not JSON. (I’d also need it all on one line…)