title: Validate xml/json before decoding in nodejs
body: <p>I was trying to get the response from some server. Server can send response in xml/json format based on the request type.</p>
  
  <p>Now how I can determine if the data has come in xml/json format, if the data is in xml format, then I can convert xml to json and do processing on json.</p>
  
  <p>Inside try/catch will not help for me, as I get the data json either stringified/parsified format.</p>
  
  <p>Now what is the best way to achieve this? Is there ant way to determine if the data is xml/json format before decoding?</p>
  
  <p>Regards,
  -M-</p>