I am using the following statement to get weather information, but I cannot figure out how to set the text encoding to remove the extra characters. It shows fine in browsers, but not in desktopinfo.
HTTPGET=interval:600,source: http://wttr.in/chicago?u&format=Cond:+%C|Temp:+%t|Wind:+%w,display:%1,Wide:1
try adding a regex to filter out non ascii characters:
regex:[^\x00-\x7F]+
btw the next release will have a little code to deal with json response in HTTPGET
Thanks for implementing the JSON parsing! I've been trying to use it, but am having an issue getting any data.
This is the portion of the JSON output from wttr.in I need to parse:
{ "current_condition": [ { "FeelsLikeC": "-1", "FeelsLikeF": "31", "cloudcover": "0", "humidity": "64", "localObsDateTime": "2024-12-03 11:08 AM", "observation_time": "04:08 PM", "precipInches": "0.0", "precipMM": "0.0", "pressure": "1025", "pressureInches": "30", "temp_C": "3", "temp_F": "37", "uvIndex": "1", "visibility": "16", "visibilityMiles": "9", "weatherCode": "113", "weatherDesc": [ { "value": "Sunny" } ], "weatherIconUrl": [ { "value": "" } ], "winddir16Point": "NW", "winddirDegree": "307", "windspeedKmph": "14", "windspeedMiles": "9" } ], ...
This is the statement I am using:
HTTPGET=interval:600,source: https://wttr.in/chicago?u&format=j1,json-keys:current_condition.Temp_F, text:Temp: %1F
Which does not work. I'm new to using JSON data. Any Help?
i know i had to do some reading to figure out how to navigate json. you'll notice the square bracket immediately after "current_condition". this indicates current_condition is an array and what follows is an element of that array. The closing bracket for the array element is right at the end. There is just one element in this array. So I believe the correct way to reference the content in question is:
current_condition[0].temp_F
Thanks. I'm a dumbass and was using Temp_F forgetting that it's case sensitive.