I'm consuming the Microsoft translation API, they That is, MICROSOFT returns XML in its API's), I was able to execute everything right, but as I hate working with XML I decided to convert from XML to JSON, with the library Json.NET , the XML translation response is:
<string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">Mechanical</string>
When I convert to JSON through Json.NET:
XmlDocument doc = new XmlDocument();
doc.LoadXml(response.Content);
string json = JsonConvert.SerializeXmlNode(doc);
Debug.WriteLine(json);
I get this:
{"string":{"@xmlns":"http://schemas.microsoft.com/2003/10/Serialization/","#text":"mechanical"}}
If I try to access XML
I get an error in the browser:
SyntaxError: illegal character
How to access string.#text
if the format converter is adding special characters in the attribute name? I noticed that this occurs in the Json.NET example