I would retrieve the response always as string and first check the first character to see if it is a JSON response or something else (The JSON starts with a [ character you could use). If it is JSON do the import mapping. If it is not create a log where you store the other results.
Regards,
Ronald