当用DataContractJsonSerializer类序列化对象为Json时,发现序列化后的json对象,每个属性都带有k__BackingField后缀,像这样:

解决办法:为要被序列化的类打上相应标记,像下面这样:

[Serializable]
[DataContract]
public class Person
{
private string _name; [DataMember]
public string Name
{
get { return _name; }
set { _name = value; }
}
}

参考:http://forums.asp.net/t/1903020.aspx/1

 

How to remove k__BackingField from Json data的更多相关文章

  1. SQL to JSON Data Modeling with Hackolade

    Review: SQL to JSON data modeling First, let’s review, the main way to represent relations in a rela ...

  2. directly receive json data from javascript in mvc

    if you send json data to mvc,how can you receive them and parse them more simply? you can do it like ...

  3. Guzzle Unable to parse JSON data: JSON_ERROR_SYNTAX - Syntax error, malformed JSON

    项目更新到正式平台时,出现Guzzle(5.3) client get请求出现:Unable to parse JSON data: JSON_ERROR_SYNTAX - Syntax error, ...

  4. SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data错误的解决

    记录个报错: 问题描述: 经过服务器生成图片返到前台时,在火狐浏览器中下载图片或打开图片时报错:SyntaxError: JSON.parse: unexpected character at lin ...

  5. SyntaxError: JSON.parse: bad control character in string literal at line 1 column 16 of the JSON data

    JSON.parse转化Json字符串时出现:SyntaxError: JSON.parse: bad control character in string literal at line 1 co ...

  6. PHP convet class to json data

    /********************************************************************* * PHP convet class to json da ...

  7. json data 解析demo

    json data: demo: JsonObject jsonObject= JsonHandle.getAsJsonObject(city_dataInfo).get("data&quo ...

  8. jQuery解析JSON出现SyntaxError: JSON.parse: unexpected character at line 1 column 2 of the JSON data

    SyntaxError: JSON.parse: unexpected character at line 1 column 2 of the JSON data 我在使用$.parseJSON解析后 ...

  9. jstree中json data 的生成

       jstree中json data 的生成 jstree官网上给出的json数据格式是这样的: <span style="font-size:14px;">// A ...

随机推荐

  1. 《Linux内核分析》第一周 计算机是如何工作的?

    刘蔚然 原创作品转载请注明出处 <Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000] WEEK ONE(2. ...

  2. Pivot C# WPF 代码添加PivotItem

    PivotItem new_PivotItem = new PivotItem();//新建Pivotitem ListView new_ListView = new ListView();//新建l ...

  3. 在Ubuntu Trusty 14.04 (LTS) (64-bit)安装Docker

    Ubuntu Trusty带来的是3.13.0 Linux kernel ,需要准备所有ubuntu库的某些条件,docker安装包被称之为docker.io.(注:Ubuntu (和Debian)包 ...

  4. cut用法

    cut命令用来剪下文本文件里的数据,文本文件可以是字段类型或是字符类型. cut - remove sections from each line of files 语法 cut  OPTION... ...

  5. VS2015/2013/2012 IIS Express Debug Classic ASP

    参考资料: https://msdn.microsoft.com/en-us/library/ms241740(v=vs.100).aspx When you attach to an ASP Web ...

  6. Linux内核中大小端判定宏

    #include <stdio.h> ];unsigned long mylong;} endian_test = { {'l','?','?','b'} }; #define ENDIA ...

  7. c#读取Word模板,利用书签替换内容包括表格

    //生成WORD程序对象和WORD文档对象 Microsoft.Office.Interop.Word.Application appWord = new Microsoft.Office.Inter ...

  8. JAVA线程池原理详解一

    线程池的优点 1.线程是稀缺资源,使用线程池可以减少创建和销毁线程的次数,每个工作线程都可以重复使用. 2.可以根据系统的承受能力,调整线程池中工作线程的数量,防止因为消耗过多内存导致服务器崩溃. 线 ...

  9. phpstorm-----------如何激活phpstorm2016

    新版激活方法: 1.在线激活 菜单help >>>> Register 选择License Server 输入 http://idea.qinxi1992.cn/ 点击ok 2 ...

  10. ACM Coder [T1002] 一直wrong answer,不知道为什么。上代码!就对就对!

    忘了改了什么,后来居然对了!做打不死的菜鸟! #include <stdio.h> #include <stdbool.h> #define arrayLength 20 #d ...