Gracefully handling JSON responses