當我使用JsonConvert.SerializeObject時,我怎樣才能得到值?我不需要像ID,名稱等重複字詞...Json.NET僅輸出C#中的值
例如:{id:189,name:'Paul',age:31,} x {[189,'Paul',31] }
謝謝!
我需要分頁類
public class PageList {
IEnumerable _rows;
int _total;
int _page;
int _records;
object _userData;
public PageList(IEnumerable rows, int page, int total, int records, object userData) {
_rows = rows;
_page = page;
_total = total;
_records = records;
_userData = userData;
}
public PageList(IEnumerable rows, int page, int total, int records)
: this(rows, page, total, records, null) {
}
public int total { get { return _total; } }
public int page { get { return _page; } }
public int records { get { return _records; } }
public IEnumerable rows { get { return _rows; } }
[JsonIgnore]
public object userData { get { return _userData; } }
public override string ToString() {
return Newtonsoft.Json.JsonConvert.SerializeObject(this, new IsoDateTimeConverter() { DateTimeFormat = "dd-MM-yyyy hh:mm:ss" });
}
}
您將如何參考屬性,當您發送對第二件事情?然後你可以堅持陣列。 – leppie