User-893317190 posted
Hi Guhananth,
If you want to validate a json or xml.
You could try to deserialize the json file and use try catch to see if it is valid.
About xml , you could load the xml file to see if it is valid.
System.Web.Script.Serialization.JavaScriptSerializer javaScriptSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
try
{
javaScriptSerializer.DeserializeObject(File.ReadAllText(Server.MapPath("/Format/json.json")));
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
try
{
XmlDocument document = new XmlDocument();
document.Load(Server.MapPath("/Format/XMLFile1.xml"));
}
catch (Exception ex)
{
Response.Write(ex);
}
You could also use visual studio to create a json file and if it is not valid ,visual studio will give a prompt.

xml is the same.
I don't know clear about what you mean by " i want to read independent tag names",could you explain it?
Best regards,
Ackerly Xu