当用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. jq 截取字符串

    var str="abcde";截取ab;str=str.substring(0,2);意思是从第一个字符开始截取两位: 一.函数:split() 功能:使用一个指定的分隔符把一个 ...

  2. 自动化环境robot framework安装中问题解决

    在搭建自动化环境的时候需要安装以下程序:

  3. java读取记事本文件的部分数据添加到mysql

    package com.tideway.readtxt; import java.io.BufferedReader; import java.io.FileInputStream; import j ...

  4. C/C++ 结构体 简单输入输出

    #include <stdio.h> #include <stdlib.h> struct student{ int num; ]; double dec; }; int ma ...

  5. 《zw版·Halcon-delphi系列原创教程》 Halcon分类函数005·graphics-obj,基本绘图单元,包括线段、矩形、椭圆、圆形

    <zw版·Halcon-delphi系列原创教程> Halcon分类函数005·graphics-obj,基本绘图单元,包括线段.矩形.椭圆.圆形 graphics-obj,基本绘图单元, ...

  6. html5,表单

    <!DOCTYPE html><html lang="en"><head>    <meta charset="UTF-8&qu ...

  7. Events in ASP.NET Master and Content Pages

    Content page PreInit event. Master page controls Init event. Content controls Init event. Master pag ...

  8. window route 命令

    使用 Route 命令行工具查看并编辑计算机的 IP 路由表.Route 命令和语法如下所示: route [-f] [-p] [Command][Destination] [mask Netmask ...

  9. php之XML转数组函数的方法

    <?/** * xml2array() will convert the given XML text to an array in the XML structure. * Link: htt ...

  10. DataTable模拟

    DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("timestep", Type.GetType(&qu ...