I cannot seem to line up the class of the Json into Linq XML.
The c.first
, c.second
and the c.third
are highlighted and states:
"Are you missing a using directive or assembly reference."
var serializer = new JavaScriptSerializer();
var json1 = "[count:[place:{first:1,second:2,third:3}],[place:{first:11,second:22,third:33}],[place:{first:111,second:222,third:333}]]]";
var jsons = serializer.Serialize(json1);
var jsona = serializer.Deserialize<List<jClass>>(jsons);
var xmld = new XDocument(
new XElement("count", jsona.Select(c =>
new XElement("place",
new XElement("first", c.first),
new XElement("second", c.second),
new XElement("third", c.third)
)
))
);
Class.cs
public class jClass
{
public jNumber[] count { get; set; }
}
public class jNumber
{
public jTopThree[] place { get; set; }
}
public class jTopThree
{
public int first { get; set; }
public int second { get; set; }
public int third { get; set; }
}