我有一个 WCF 服务,它以 JSON 格式返回数据库表。SeralizeObject 将 unicode 添加到我的 httpresponse,我该如何删除它?
代码:
using (var db = new newTestDBContext())
{
var query = from b in db.Roads
orderby b.roadID
select b;
Road rr = query.First();
var serializerSettings = new JsonSerializerSettings { PreserveReferencesHandling = PreserveReferencesHandling.Objects };
return JsonConvert.SerializeObject(rr, Formatting.Indented, serializerSettings);
回应:
"{\u000d\u000a \"$id\": \"1\",\u000d\u000a \"roadparts\": [\u000d\u000a {\u000d\u000a \"$id\": \"2\",\u000d\u000a \"Road\": {\u000d\u000a