Weather forecasts from weather.gov as JSON
On every National Weather Service forecast page, there's an orange XML button. Don't know what I'm talking about? Here:
The button is web 2.0 relic from when the conventional wisdom was that people used feed readers. Some of us still do...but that's a story for another time.
I've looked at that XML button more than once and thought: "it'd be really cool if there was a JSON equivalent". Well, there is! Clicking that button sends your browser to a URL like:
http://forecast.weather.gov/MapClick.php?lat=32.7153&lon=-117.1573&unit=0&lg=english&FcstType=dwml
Notice the FcstType=dwml
part. I don't know why, but I figured that maybe, just maybe, dwml
is the response type. I changed dwml
to json
and...voilà, JSON response! Check it out! It even has an Access-Control-Allow-Origin:*
for CORS. Or, if you're an animal, you can use JSONP with a callback
query string parameter. Every once in a while, you stumble on something that makes you smile. This was one of those times.
Have I mentioned I like weather data?