本帖最后由 ss0075 于 2015-1-6 23:05 编辑
[C#] 纯文本查看 复制代码 SiteInfo si = new SiteInfo();
userInfo ui = new userInfo();
antiInfo ai = new antiInfo();
ai.tbs = "ba02308f385014fb1420553350";
ui.id = "xxxx";
ui.name = "xxxx";
ui.BDUSS = "BDUSS";
ui.passwd = "passwd";
ui.portrait = "a1876f3134353437ea00";
si.user = ui;
si.anti = ai;
si.server_time = "255413";
si.time = 1420553350;
si.ctime = 0;
si.logid = 550120280;
si.error_code = "0";
string jsonlist = HttpHelper.ObjectToJson(si);
public class SiteInfo
{
public userInfo user { get; set; }
public antiInfo anti { get; set; }
public string server_time { get; set; }
public int time { get; set; }
public int ctime { get; set; }
public int logid { get; set; }
public string error_code { get; set; }
}
public class userInfo
{
public string id { get; set; }
public string name { get; set; }
public string BDUSS { get; set; }
public string passwd { get; set; }
public string portrait { get; set; }
}
public class antiInfo
{
public string tbs { get; set; }
}
用这个生成的 跟POST返回的格式什么的都一样 但是这样却解析不了啊。 返回的对象是空的
List<SiteInfo> jsonlist = (List<SiteInfo>)HttpHelper.JsonToObject<List<SiteInfo>>(textBox1.Text);
jsonlist = null
[C#] 纯文本查看 复制代码 {"user":{"id":"xxxx","name":"xxxx","BDUSS":"xxxx","passwd":"xxxxx","portrait":"a1876f3134353437ea00"},"anti":{"tbs":"4a5c237afb55bcf31420556686"},"server_time":"346256","time":1420556686,"ctime":0,"logid":286529062,"error_code":"0"}
这是返回的json
|