Fix issue where JSON.parse(undefined) throws exception

Observed an error "unexpected token u" on an Android WebView, searched around a little, and discovered JSON.parse with undefined can cause issues on some browsers: http://stackoverflow.com/a/13022566