当用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. 录制简单的自动化测试工具SlikMobile初体验

    今天朋友推荐了款自动化测试工具SlikMobile,下载了个试用了下,感觉还是很容易入门和上手的,感觉和testin的工具差不多,跨平台,多语言支持,支持图片.文本和Native Class三种对象方 ...

  2. 去掉comments

    三种comments: /* Test program */ int main() { // variable declaration int a, b, c; /* This is a test m ...

  3. LeetCode Factor Combinations

    原题链接在这里:https://leetcode.com/problems/factor-combinations/ 题目: Numbers can be regarded as product of ...

  4. 导入charts开源库到工程里面

    http://blog.csdn.net/zww1984774346/article/details/50608338 http://blog.csdn.net/zww1984774346/artic ...

  5. 创建和导出SVG的技巧(转载)

    本文转载自: 创建和导出SVG的技巧

  6. 重新安装了mysql,以前的数据库如何导入到新的数据库

    重新安装了mysql,以前的数据库如何导入到新的数据库,导入到新的数据库不能用真么办? 将之前的mysql中的data目录中的数据库文件夹,(需要哪个数据库复制哪个,不要都复制) D:/wamp/bi ...

  7. getopt解析命令行参数一例:汇集多个服务器的日志

    高效工作的一个诀窍就是尽可能自动化, 简便化. 比如, 公司里, 要搜索多个集群下的应用日志来排查问题, 需要使用 pssh: pssh -i -h api_hangzhou.iplist " ...

  8. shell脚本 空格

    1.定义变量时, =号的两边不可以留空格. eg: gender=femal----right gender =femal---–wrong gender= femal---–wrong 2.条件测试 ...

  9. php缓冲区 sapi缓冲区

    <?php#设置php.ini中output_buffering = 32#使用apache可以看到效果 #nginx+php-fpm看不到效果 nginx缓存 sockets通信问题?#imp ...

  10. linux查看磁盘系统df,du

    可以用df命令轻松地查看所有已挂载磁盘的使用情况 df df -h 把输出的文件单位换成文件可读的单位 du 命令显示特定目录的使用情况 du -c 显示总用量 du -h 人类可读性 du -s 每 ...