您的位置:首页 > 移动开发 > Objective-C

Newtonsoft.Json对object进行json转化(时间格式的处理)

2012-10-17 11:40 507 查看
/// <summary>

/// object转化为json时Datetime类型格式转化

/// </summary>

/// <returns></returns>

private static IsoDateTimeConverter SetJsonDateTimeFormate()

{

IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();

timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm";

return timeConverter;

}

//将object转化成json格式

private string GetConvertEntityJson(string id)

{

string json = "";

BPileinfo bllPileinfo = new BPileinfo();

MES_YD_PILEINFO pileInfo = bllPileinfo.GetPileinfoInfo(id);

json = JsonConvert.SerializeObject(pileInfo, SetJsonDateTimeFormate());

return json;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: