How to Deserialize JSON data? C#

前端 未结 5 1567
感情败类
感情败类 2020-12-22 10:22

Im getting a Json Data from an API and i have been trying to deserialize.

Json data:

{
   \"items\": [
      {
         \"id\": \"1\",
         \"nam         


        
5条回答
  •  無奈伤痛
    2020-12-22 10:43

    Your Json string is good formatted and the entities are according to Json2Csharp good too.

    but your problem is with the instruction JsonConvert.DeserializeObject>(content);

    all that json that you have is only ONE User, and you are trying to get a list of them, there is the issue,

    you can try instead with:

    JsonConvert.DeserializeObject(content);
    

提交回复
热议问题