JSon反序列化错误

Nov 20, 2012 at 2:47 AM
Edited Nov 20, 2012 at 2:47 AM

调用Sina.API.Entity.Statuses.FriendsTimeline或Sina.API.Entity.Statuses.UserTimeline,返回的json.Statuses总是null,跟了一下发现貌似在反序列Json的时候出现了问题,暂时还没有找到原因,维护Team的同学们有没有考虑调查一下啊?

Nov 21, 2012 at 2:37 AM
Edited Nov 21, 2012 at 2:45 AM

好吧,蛋疼对比了Release3和Release的Source,发现在Release4里面,对于status的Collection的实体定义如下:

namespace NetDimension.Weibo.Entities.status
{
    using NetDimension.Json;
    using NetDimension.Weibo.Entities;
    using System;
    using System.Collections.Generic;
    using System.Runtime.CompilerServices;

    public class Collection : EntityBase
    {
        [JsonProperty(PropertyName="next_cursor")]
        public string NextCursor { get; internal set; }

        [JsonProperty(PropertyName="previous_cursor")]
        public string ProviousCursor { get; internal set; }

        [JsonProperty(PropertyName="reposts")]
        public IEnumerable<Entity> Statuses { get; internal set; }

        [JsonProperty(PropertyName="total_number")]
        public int TotalNumber { get; internal set; }
    }
}

注意红色部分代码,release3版里面的这里是这样的:

[JsonProperty(PropertyName="statuses")]
public IEnumerable<Entity> Statuses { get; internal set; }

结合新浪的API接口可以确定,Release4的使用reports是错了,导致反序列化错误的原因应该就是这样。~~~~

Coordinator
Feb 28, 2013 at 5:50 AM
也?好像我记得我新家过一个类了,等我再看看。。。。