Unity3D/C#
xml to json
일등하이
2020. 8. 5. 10:10
반응형
private void ParseXML(string xml)
{
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
doc.ChildNodes.OfType<XmlNode>().Where(x => x.NodeType == XmlNodeType.XmlDeclaration).ToList().ForEach(x => doc.RemoveChild(x));
string json = JsonConvert.SerializeXmlNode(doc);
Debug.Log(json);
var a = JsonConvert.DeserializeObject(json);
}
https://stackoverrun.com/ko/q/9024392
c# - JSON.Net을 사용하여 XML을 JSON String으로 변환 할 때 원하는 결과를 얻지 못합니다.
다음은 JSON 문자열로 변환하려는 XML 문자열입니다. 다음 코드를 사용이 1 Surya ...
stackoverrun.com
https://www.newtonsoft.com/json/help/html/ConvertXmlToJsonForceArray.htm
Convert XML to JSON and force array
This sample reads the json:Array="true" attribute in the XML and places its value in an array when converting the XML to JSON.
www.newtonsoft.com
반응형