/// <summary> /// Deserializes JSON from a XML reader which implements the /// <a href="http://msdn.microsoft.com/en-us/library/bb924435.aspx">mapping between JSON and XML</a>. /// </summary> /// <param name="jsonReader">The <see cref="System.Xml.XmlDictionaryReader"/> which /// exposes JSON as XML.</param> /// <returns>The <see cref="System.Json.JsonValue"/> that represents the parsed /// JSON/XML as a CLR type.</returns> public static JsonValue Load(XmlDictionaryReader jsonReader) { if (jsonReader == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("jsonReader")); } return(JXmlToJsonValueConverter.JXMLToJsonValue(jsonReader)); }
/// <summary> /// Serializes this <see cref="System.Json.JsonValue"/> CLR type into a JSON/XML writer using the /// <a href="http://msdn.microsoft.com/en-us/library/bb924435.aspx">mapping between JSON and XML</a>. /// </summary> /// <param name="jsonValue">The <see cref="JsonValue"/> instance this method extension is to be applied to.</param> /// <param name="jsonWriter">The JSON/XML writer used to serialize this instance.</param> public static void Save(this JsonValue jsonValue, XmlDictionaryWriter jsonWriter) { if (jsonValue == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("jsonValue")); } if (jsonWriter == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("jsonWriter")); } JXmlToJsonValueConverter.JsonValueToJXML(jsonWriter, jsonValue); }