Dark Sky Weather API

var=system.net.httpGet("https://api.darksky.net/forecast/APIKEY/9ce/43.059551,-109.594494")
print var

This returns something like the following:

{“latitude”:43.059551,“longitude”:-109.594494,“timezone”:“America/Denver”,“currently”:{“time”:1563910811,“summary”:“Partly Cloudy”,“icon”:“partly-cloudy-day”,“nearestStormDistance”:0,“precipIntensity”:0.003,“precipProbability”:0.01,“precipType”:“rain”,“temperature”:67.71,“apparentTemperature”:67.71,“dewPoint”:39.09,“humidity”:0.35,“pressure”:1015.7,“windSpeed”:4.8,“windGust”:9.94,“windBearing”:234,“cloudCover”:0.13,“uvIndex”:.and so on…

What is the best practice for using what is returned? How to search and iterate through this? Thanks!

Parse it with system.util.jsonDecode and then access the info you’re interested in by keys.

2 Likes
var = system.net.httpGet("https://api.darksky.net/forecast/APIKEY/43.059551,-109.594494")
obj = system.util.jsonDecode(var)

obj['currently']['temperature']
1 Like