项目中对象转json字符串时,如下: JsonSerializerSettings jsetting = new JsonSerializerSettings();jsetting.DefaultValueHandling = DefaultValueHandling.Ignore;return JsonConvert.SerializeObject(resultMoldels, Formatting.Indented, jsetting); 发现返回的字符串中包含换行符 \r\n
"{\r\n \"result\": true,\r\n \"msg\": \"OK\",\r\n \"data\": [\r\n \"success\",\r\n \"123456789\",\r\n \"987654321\"\r\n ]\r\n}"
解决方法: Formatting.Indented 修改成 Formatting.None