Check if a response string is a JSON Object or an XML?
Check the content type of the response message.
if (response.Content.Headers.ContentType.MediaType == "application/json")
{
// parse json
}
else
{
// parse xml
}
You can also read the first character from the response.
If it's a XML content, you should find a <
. Even if the XML declaration is present or not.