0
洗練されたxmlをjsonに変換したい。私はこの試みた:Sharepoint refinement xml to json
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
var refinementManager = RefinementManager.GetInstance(Page);
var xmlDocument = refinementManager.GetRefinementXml();
DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(XmlDocument));
MemoryStream ms = new MemoryStream();
ser.WriteObject(ms, xmlDocument);
string json = Encoding.Default.GetString(ms.ToArray());
}
をしかし、私はエラーを取得:
Type 'System.Xml.XmlDocument' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute.
があります任意のだったこのXMLをJSONに変換するには? JSON.net(http://json.codeplex.com/)がこれは信頼できるライブラリですか?