I’m a novice developer. I’m trying to read the JSON response from a webserver and I’m close but am getting and error that looks like it is because I’m trying to render to my Pixlet a string when the variable is apparently a floating point number. I’m trying get the current temperature from a temperature/humidity sensor. The JSON data is fairly long and complex however all I want to get is the current temperature.
Here is my code
rep = http.get(URL)
if rep.status_code != 200:
fail(“Request failed with status %d”, rep.status_code)
value = rep.json()["attributes"]["currentValue"] return render.Root( child = render.Text(value) )
Update: I figured out how to convert the number to a string with the str() function