catching json errors in a different way