You should be checking that you received JSON content in your response.