I'm Deserialize one XML to one Object, afterwards I serialize this object in one JSON, this process works, but the problem I have with the ouput in json I receive, it's incorrect.. acording with the structure I have..
Because my Root level is missing.., I can't find why, if every is correct?
XML File:
<?xml version="1.0" encoding="UTF-8" ?>
<Root>
<Applications>
.....
</Applications>
</Root>
c# code:
Root root;
using (StreamReader readerConfig = new StreamReader(appDataXml))
{
root = (Root)serializerConfig.Deserialize(readerConfig);
}
var sz = JsonConvert.SerializeObject(root);
c# Class:
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
public partial class Root {
private RootApplication[] applicationsField;
/// <remarks/>
[System.Xml.Serialization.XmlArrayItemAttribute("Application", IsNullable=false)]
public DashBoardApplication[] Applications {
Ouput:
{"Applications":[{......}]}
Ouput I want:
{"Root":{Applications":[{......}]}}