/// <inheritdoc/> protected override IResponse <T> Deserialize <T>(string str, HttpSenderOptions options) { var jBody = JToken.Parse(str); if (options.ValidateErrorsInResponse && TryExtractErrorFromBody(jBody, out var err)) { return(ResponseFactory.CreateFault <T>(err)); } var result = jBody.ToObject <T>(JsonSerializer.Create(options.JsonParseSettings.Deserializing)); return(ResponseFactory.CreateSuccess(result)); }
/// <inheritdoc/> protected override IResponse <T> Deserialize <T>(string str, HttpSenderOptions options) { var doc = XDocument.Parse(str); if (options.ValidateErrorsInResponse && TryExtractErrorFromBody(doc, out var err)) { return(ResponseFactory.CreateFault <T>(err)); } if (options.XmlParseSettings.Deserialize.RemoveEmptyElements) { XmlUtils.RemoveEmptyElementsFrom(doc); } if (options.XmlParseSettings.Deserialize.RemoveNilElements) { doc.RemoveNilElements(); } return(ResponseFactory.CreateSuccess(XmlUtils.CastXDocumentToObj <T>(doc))); }