This is somewhat related to #5. Although it is probably safe to assume that the JSON dictionary I'm trying to parse will always be in the same order... it might not.
Therefore, I'd like to do something like:
hourly_file = io.open("hourly.json",'rb')
json_data = adafruit_json_stream.load(hourly_file)
periods = json_data['properties']['periods']
for period in periods:
for (key,value) in period.items():
print(f"{key} = {value}")
But, there is no items() in TransientObject. How hard would this be to implement? (The above code works with full json_stream, as does something like:
for (key,value) in period.items():
if key == 'number':
print(f"Number: {value}")
elif key == 'temperature':
print(f"Temp: {value}")
elif key == 'probabilityOfPrecipitation':
print(f"Rain%: {value['value']}")
which is basically exacatly what I want to do (except more than just printing of course).
This is somewhat related to #5. Although it is probably safe to assume that the JSON dictionary I'm trying to parse will always be in the same order... it might not.
Therefore, I'd like to do something like:
But, there is no
items()in TransientObject. How hard would this be to implement? (The above code works with fulljson_stream, as does something like:which is basically exacatly what I want to do (except more than just printing of course).