I think this might just work... What you want to do here is a check to see if the swa object exists using the known fact that javascript objects are sparsely populated arrays.
There are several ways to do this. var swa = null; if (weather['swa']) { swa = weather.swa.a[0].t; }
OR
if (weather.hasOwnProperty('swa')) { swa = weather.swa.a[0].t; }
The 2nd one, you can read about on google or the mozilla site as well as in Flanagan.