title: .NET Core : deserialization issue + how to get better insight into non-useful error text
body: <p>I have the following JSON which I ran through a validator and 'Pasted JSON as classes' to build a model from the schema in Visual Studio:</p>
  <pre><code>{
    &quot;entity&quot;: {
      &quot;Successful Requests&quot;: [
        {
          &quot;Status&quot;: 201,
          &quot;Resource ID&quot;: 34715818,
          &quot;Message&quot;: &quot;Created resource 1 at URI: /rest/equipment/ids/34715818&quot;
        },
        {
          &quot;Status&quot;: 201,
          &quot;Resource ID&quot;: 34715838,
          &quot;Message&quot;: &quot;Created resource 2 at URI: /rest/equipment/ids/34715838&quot;
        }
      ],
      &quot;Failed Requests&quot;: [
        {
          &quot;Status&quot;: 500,
          &quot;Resource ID&quot;: -1,
          &quot;Message&quot;: &quot;Failed to create new resource 1. Bulk update failed. Cause: Template 'xxx' not found.&quot;
        },
        {
          &quot;Status&quot;: 500,
          &quot;Resource ID&quot;: -1,
          &quot;Message&quot;: &quot;Failed to create new resource 2. Bulk update failed. Cause: Template 'xxx' not found.&quot;
        }
      ]
    },
    &quot;variant&quot;: {
      &quot;language&quot;: null,
      &quot;mediaType&quot;: {
        &quot;type&quot;: &quot;application&quot;,
        &quot;subtype&quot;: &quot;json&quot;,
        &quot;parameters&quot;: {},
        &quot;wildcardType&quot;: false,
        &quot;wildcardSubtype&quot;: false
      },
      &quot;encoding&quot;: null,
      &quot;languageString&quot;: null
    },
    &quot;annotations&quot;: [],
    &quot;mediaType&quot;: {
      &quot;type&quot;: &quot;application&quot;,
      &quot;subtype&quot;: &quot;json&quot;,
      &quot;parameters&quot;: {},
      &quot;wildcardType&quot;: false,
      &quot;wildcardSubtype&quot;: false
    },
    &quot;language&quot;: null,
    &quot;encoding&quot;: null
  }
  </code></pre>
  <p>This builds the following classes (I added the <code>JsonProperties</code> in the entity class because the property names contain spaces, I also tried without them and I get the same error):</p>
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Threading.Tasks;
  using Newtonsoft.Json;
  
  namespace xxx.Data.Models
  {
      public class Rootobject
      {
          public Entity entity { get; set; }
  
          public Variant variant { get; set; }
          public object[] annotations { get; set; }
          public Mediatype1 mediaType { get; set; }
          public object language { get; set; }
          public object encoding { get; set; }
      }
  
      public class Entity
      {
          [JsonProperty(&quot;Successful Requests&quot;)]
          public SuccessfulRequest[] SuccessfulRequests { get; set; }
          [JsonProperty(&quot;Failed Requests&quot;)]
          public FailedRequest[] FailedRequests { get; set; }
      }
  
      public class SuccessfulRequest
      {
          public int Status { get; set; }
          public int ResourceID { get; set; }
          public string Message { get; set; }
      }
  
      public class FailedRequest
      {
          public int Status { get; set; }
          public int ResourceID { get; set; }
          public string Message { get; set; }
      }
  
      public class Variant
      {
          public object language { get; set; }
          public Mediatype mediaType { get; set; }
          public object encoding { get; set; }
          public object languageString { get; set; }
      }
  
      public class Mediatype
      {
          public string type { get; set; }
          public string subtype { get; set; }
          public Parameters parameters { get; set; }
          public bool wildcardType { get; set; }
          public bool wildcardSubtype { get; set; }
      }
  
      public class Parameters
      {
      }
  
      public class Mediatype1
      {
          public string type { get; set; }
          public string subtype { get; set; }
          public Parameters1 parameters { get; set; }
          public bool wildcardType { get; set; }
          public bool wildcardSubtype { get; set; }
      }
  
      public class Parameters1
      {
      }
  }
  </code></pre>
  <p>I make an API call in code:</p>
  <pre><code>var response = await _repositorySvc.PutBulkEquipment(requestBody, Guid.NewGuid());
  var result = response.Content.ReadAsStringAsync().Result;
  _logger.LogWarning(&quot;------------------Result:&quot;);
  _logger.LogWarning(result);
  </code></pre>
  <p>Which returns the following JSON string in the console:</p>
  <pre><code>{
    &quot;entity&quot;: &quot;{\&quot;Successful Requests\&quot;:[{\&quot;Status\&quot;:201,\&quot;Resource ID\&quot;:34715872,\&quot;Message\&quot;:\&quot;Created resource 1 at URI: /rest/equipment/ids/34715872\&quot;},{\&quot;Status\&quot;:201,\&quot;Resource ID\&quot;:34715892,\&quot;Message\&quot;:\&quot;Created resource 2 at URI: /rest/equipment/ids/34715892\&quot;}],\&quot;Failed Requests\&quot;:[]}&quot;,
    &quot;variant&quot;: {
      &quot;language&quot;: null,
      &quot;mediaType&quot;: {
        &quot;type&quot;: &quot;application&quot;,
        &quot;subtype&quot;: &quot;json&quot;,
        &quot;parameters&quot;: {},
        &quot;wildcardType&quot;: false,
        &quot;wildcardSubtype&quot;: false
      },
      &quot;encoding&quot;: null,
      &quot;languageString&quot;: null
    },
    &quot;annotations&quot;: [],
    &quot;mediaType&quot;: {
      &quot;type&quot;: &quot;application&quot;,
      &quot;subtype&quot;: &quot;json&quot;,
      &quot;parameters&quot;: {},
      &quot;wildcardType&quot;: false,
      &quot;wildcardSubtype&quot;: false
    },
    &quot;language&quot;: null,
    &quot;encoding&quot;: null
  }
  </code></pre>
  <p>Then, when I attempt to deserialize the string to the Entity class:</p>
  <pre><code>var deserializedResponse = JsonConvert.DeserializeObject&lt;Rootobject&gt;(result);
  </code></pre>
  <p>I get the following error:</p>
  <blockquote>
  <p>Error converting value
  &quot;{&quot;Successful Requests&quot;:[{&quot;Status&quot;:201,&quot;Resource ID&quot;:34715872,&quot;Message&quot;:&quot;Created resource 1 at URI: /rest/equipment/ids/34715872&quot;},{&quot;Status&quot;:201,&quot;Resource ID&quot;:34715892,&quot;Message&quot;:&quot;Created resource 2 at URI: /rest/equipment/ids/34715892&quot;}],&quot;Failed Requests&quot;:[]}&quot;<br />
  to type 'xxx.Data.Models.Entity'.<br />
  Path 'entity', line 1, position 290.</p>
  </blockquote>
  <ol>
  <li><p>Would anyone be able to spot any mistakes I'm making that I might be missing in the above scenario that could be contributing to me banging my head on a wall for the past day and a half on this? Everything looks correct to me and I'm stumped - I do a lot of deserialization and usually it's ez-mode so I'm not sure what I'm missing.</p>
  </li>
  <li><p>Is there any way to get better insight into deserialization issues in .NET Core?</p>
  </li>
  </ol>
  <p>Thank you!</p>