Convert List<Entity> to Json String.

public static string ToJson(this object obj, string datetimeformats)

 {
     var timeConverter = new IsoDateTimeConverter { DateTimeFormat = datetimeformats };
      return JsonConvert.SerializeObject(obj, timeConverter);
 }

Call: var json=.Json.ToJson(service.FindList());  

List<Entity>:

 

Json String:

 

 

posted @ 2018-04-25 10:04  AriLee  Views(389)  Comments(0Edit  收藏  举报