Handling malformed JSON response exception

Fixes crash due to malformed JSON in response.