How to verify what datatype the response is

You can use JSON Schema technology for verifying JSON instances against schema. For example, see

However, this would require seasoned skill of programming — not very easy.