Try this:
public JsonResult ReturnJsonValues()
{
// Creted XML object
var xml =
@"<Columns>
<Column Name=""key1"" DataType=""Boolean"">True</Column>
<Column Name=""key2"" DataType=""String"">Hello World</Column>
<Column Name=""key3"" DataType=""Integer"">999</Column>
</Columns>";
// conver xml to Jcon
var dic = XDocument
.Parse(xml)
.Descendants("Column")
.ToDictionary(
c => c.Attribute("Name").Value,
c => c.Value
);
var json = new JavaScriptSerializer().Serialize(dic);
// Return the Json object using asp.net MVC
return Json(json, JsonRequestBehavior.AllowGet);
}
I hope this will help .. :)
Thanks,
Bimal