Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/264.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Json反序列化没有结果_C#_Json - Fatal编程技术网

C# Json反序列化没有结果

C# Json反序列化没有结果,c#,json,C#,Json,我从zoho那里得到json。我有一个JSON,如下所示: { "response": { "result": { "Leads": { "row": [ { "no": "1", "FL": [ { "content": "1325469000000679001", "val": "LEADID"

我从zoho那里得到json。我有一个JSON,如下所示:

{
  "response": {
    "result": {
      "Leads": {
        "row": [
          {
            "no": "1",
            "FL": [
              {
                "content": "1325469000000679001",
                "val": "LEADID"
              },
              {
                "content": "1325469000000075001",
                "val": "SMOWNERID"
              },
              {
                "content": "Geoff",
                "val": "Lead Owner"
              },
            ]
          },
          {
            "no": "2",
            "FL": [
              {
                "content": "1325469000000659017",
                "val": "LEADID"
              },
              {
                "content": "1325469000000075001",
                "val": "SMOWNERID"
              },
              {
                "content": "Geoff",
                "val": "Lead Owner"
              },
            ]
          },

        ]
      }
    },
    "uri": "/crm/private/json/Leads/getRecords"
  }
}
我正在使用以下课程:

public class Row
{

    [JsonProperty(PropertyName = "row")]
    public List<Leads> row { get; set; }

}

public class Leads
{
    [JsonProperty(PropertyName = "no")]
    public string nbr { get; set; }

    [JsonProperty(PropertyName = "FL")]
    public List<Lead> FieldValues { get; set; }

}

public class Lead
{

    [JsonProperty(PropertyName = "content")]
    public string Content { get; set; }

    [JsonProperty(PropertyName = "val")]
    public string Val { get; set; }

}
公共类行
{
[JsonProperty(PropertyName=“row”)]
公共列表行{get;set;}
}
公共课领导
{
[JsonProperty(PropertyName=“否”)]
公共字符串nbr{get;set;}
[JsonProperty(PropertyName=“FL”)]
公共列表字段值{get;set;}
}
公共级领导
{
[JsonProperty(PropertyName=“content”)]
公共字符串内容{get;set;}
[JsonProperty(PropertyName=“val”)]
公共字符串Val{get;set;}
}
我尝试反序列化json,但什么也没有得到:

var mList = JsonConvert.DeserializeObject<IDictionary<string, Row>>(result);
var mList=JsonConvert.DeserializeObject(结果);

这是第一次使用Json,因此任何帮助都将不胜感激

通常发生这种情况是因为反序列化的类模型错误。而不是试图手工制作我喜欢使用的类。只需插入JSON,它就会为您提供必要的C#类。在您的案例中,它提供了以下内容

public class FL
{
    public string content { get; set; }
    public string val { get; set; }
}

public class Row
{
    public string no { get; set; }
    public List<FL> FL { get; set; }
}

public class Leads
{
    public List<Row> row { get; set; }
}

public class Result
{
    public Leads Leads { get; set; }
}

public class Response
{
    public Result result { get; set; }
    public string uri { get; set; }
}

public class RootObject
{
    public Response response { get; set; }
}
公共类FL
{
公共字符串内容{get;set;}
公共字符串val{get;set;}
}
公共类行
{
公共字符串no{get;set;}
公共列表FL{get;set;}
}
公共课领导
{
公共列表行{get;set;}
}
公开课成绩
{
公共线索{get;set;}
}
公众课堂反应
{
公共结果结果{get;set;}
公共字符串uri{get;set;}
}
公共类根对象
{
公共响应{get;set;}
}
然后,可以使用以下命令反序列化到RootObject中:

var mList = JsonConvert.DeserializeObject<RootObject>(result);
var mList=JsonConvert.DeserializeObject(结果);

请随意将
RootObject
重命名为您更喜欢的任何名称。

通常发生这种情况的原因是您的反序列化类模型错误。而不是试图手工制作我喜欢使用的类。只需插入JSON,它就会为您提供必要的C#类。在您的案例中,它提供了以下内容

public class FL
{
    public string content { get; set; }
    public string val { get; set; }
}

public class Row
{
    public string no { get; set; }
    public List<FL> FL { get; set; }
}

public class Leads
{
    public List<Row> row { get; set; }
}

public class Result
{
    public Leads Leads { get; set; }
}

public class Response
{
    public Result result { get; set; }
    public string uri { get; set; }
}

public class RootObject
{
    public Response response { get; set; }
}
公共类FL
{
公共字符串内容{get;set;}
公共字符串val{get;set;}
}
公共类行
{
公共字符串no{get;set;}
公共列表FL{get;set;}
}
公共课领导
{
公共列表行{get;set;}
}
公开课成绩
{
公共线索{get;set;}
}
公众课堂反应
{
公共结果结果{get;set;}
公共字符串uri{get;set;}
}
公共类根对象
{
公共响应{get;set;}
}
然后,可以使用以下命令反序列化到RootObject中:

var mList = JsonConvert.DeserializeObject<RootObject>(result);
var mList=JsonConvert.DeserializeObject(结果);

请随意将
RootObject
重命名为您更喜欢的任何名称。

通常发生这种情况的原因是您的反序列化类模型错误。而不是试图手工制作我喜欢使用的类。只需插入JSON,它就会为您提供必要的C#类。在您的案例中,它提供了以下内容

public class FL
{
    public string content { get; set; }
    public string val { get; set; }
}

public class Row
{
    public string no { get; set; }
    public List<FL> FL { get; set; }
}

public class Leads
{
    public List<Row> row { get; set; }
}

public class Result
{
    public Leads Leads { get; set; }
}

public class Response
{
    public Result result { get; set; }
    public string uri { get; set; }
}

public class RootObject
{
    public Response response { get; set; }
}
公共类FL
{
公共字符串内容{get;set;}
公共字符串val{get;set;}
}
公共类行
{
公共字符串no{get;set;}
公共列表FL{get;set;}
}
公共课领导
{
公共列表行{get;set;}
}
公开课成绩
{
公共线索{get;set;}
}
公众课堂反应
{
公共结果结果{get;set;}
公共字符串uri{get;set;}
}
公共类根对象
{
公共响应{get;set;}
}
然后,可以使用以下命令反序列化到RootObject中:

var mList = JsonConvert.DeserializeObject<RootObject>(result);
var mList=JsonConvert.DeserializeObject(结果);

请随意将
RootObject
重命名为您更喜欢的任何名称。

通常发生这种情况的原因是您的反序列化类模型错误。而不是试图手工制作我喜欢使用的类。只需插入JSON,它就会为您提供必要的C#类。在您的案例中,它提供了以下内容

public class FL
{
    public string content { get; set; }
    public string val { get; set; }
}

public class Row
{
    public string no { get; set; }
    public List<FL> FL { get; set; }
}

public class Leads
{
    public List<Row> row { get; set; }
}

public class Result
{
    public Leads Leads { get; set; }
}

public class Response
{
    public Result result { get; set; }
    public string uri { get; set; }
}

public class RootObject
{
    public Response response { get; set; }
}
公共类FL
{
公共字符串内容{get;set;}
公共字符串val{get;set;}
}
公共类行
{
公共字符串no{get;set;}
公共列表FL{get;set;}
}
公共课领导
{
公共列表行{get;set;}
}
公开课成绩
{
公共线索{get;set;}
}
公众课堂反应
{
公共结果结果{get;set;}
公共字符串uri{get;set;}
}
公共类根对象
{
公共响应{get;set;}
}
然后,可以使用以下命令反序列化到RootObject中:

var mList = JsonConvert.DeserializeObject<RootObject>(result);
var mList=JsonConvert.DeserializeObject(结果);

请随意重命名
RootObject
为您更喜欢的任何名称。

使用剪贴板上的JSON字符串,您可以执行编辑->粘贴特殊->粘贴JSON作为类,VS将使用剪贴板上的JSON字符串从JSON为您创建类,您可以执行编辑->粘贴特殊->粘贴JSON作为类,VS将使用剪贴板上的JSON字符串从JSON为您创建类,您可以执行编辑->粘贴特殊->粘贴JSON作为类,VS将使用剪贴板上的JSON字符串从JSON为您创建类,您可以编辑->粘贴特殊->将JSON粘贴为类,VS将从JSON为您创建类