こんにちは、xml を文字列として渡しています
<AbcDto xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Abc">
<Id>2</Id>
<Description>sample string 4</Description>
<Name>sample string 3</Name>
<PolicyId>c17f5b9f-c9bf-4a3a-b09b-f44ec84b0d00</PolicyId>
<Status>Active</Status>
<TimeZoneId>USCentral</TimeZoneId>
</AbcDto>
Web Api 用のカスタム モデル バインダーを作成しようとしている場合
public bool BindModel(System.Web.Http.Controllers.HttpActionContext actionContext, ModelBindingContext bindingContext)
{
var json = actionContext.Request.Content.ReadAsStringAsync().Result;
if (!string.IsNullOrEmpty(json))
{
var jsonObject = (JObject) Newtonsoft.Json.JsonConvert.DeserializeObject(json);
var jsonPropertyNames = jsonObject.Properties().Select(p => p.Name).ToList();
以下のメソッドにパラメーターとして渡される json 文字列は、文字列としての xml です。 Newtonsoft.Json.JsonConvert.DeserializeObject(json); で例外に直面しています。例外の詳細: 値の解析中に予期しない文字が検出されました: <。パス ''、行 0、位置 0。