小编Gea*_*olt的帖子

如何使用C#中的Json.NET从JSON访问嵌套对象

如何使用类装饰在嵌套对象中选择json值"estimatedLocationDate"?属性"estimatedLocationDate"始终返回null而不是值2015-10-01T14:00:00.000.其他修饰值返回正确的值.

这是我的C#

public string id { get; set; }

public string name { get; set; }

[JsonProperty("publishedDate")]
public string publishdate { get; set; }

[JsonProperty("estimatedLocationDate")]
public string estimatedLocationDate{ get; set; }

[JsonProperty("createdTime")]
public string createtime { get; set; }

[JsonProperty("lastUpdatedTime")]
public string lastupdate { get; set; }
Run Code Online (Sandbox Code Playgroud)

而这就是 JSON

"planet": [
    {
        "id": "123456",
        "planetid": "en-us/Jupiter-mars/---main",
        "name": "The planet Mercury",
        "description": "This is placeholder for the description",
        "publishedDate": "2013-10-14T23:30:00.000",
        "createtime": "2012-03-01T14:00:00.000",
        "product": …
Run Code Online (Sandbox Code Playgroud)

.net c# json json.net

2
推荐指数
1
解决办法
5722
查看次数

标签 统计

.net ×1

c# ×1

json ×1

json.net ×1