Adding property to a json object in C#

 

you can do it with a dynamic object

        dynamic obj = JsonConvert.DeserializeObject<ExpandoObject>(jsonString);
obj.Values.valueName4 = "value4";
System.Console.WriteLine(JsonConvert.SerializeObject(obj));

How to add an extra property into a serialized JSON string using json.net?

Adding property to a json object in C#的更多相关文章

  1. 向json中添加新的熟悉或对象 Add new attribute (element) to JSON object using JavaScript

    How do I add new attribute (element) to JSON object using JavaScript? JSON stands for JavaScript Obj ...

  2. Main property in package.json defines package entry point

    I know my project's dependencies are installed under node_modules directory. But when I do require(' ...

  3. json loads No JSON object could be decoded 问题解决

    今天自己用json的 dumps生成的 json 文本: f2=open(filename,'w')f2.write(json.dumps(c) f=open(filename,'r')r= f.re ...

  4. HTTPResponse object — JSON object must be str, not 'bytes'

    http://stackoverflow.com/questions/24069197/httpresponse-object-json-object-must-be-str-not-bytes HT ...

  5. WINDOWS下,中文JSON格式读取报错处理:ValueError: No JSON object could be decoded

    File "C:\Python27\lib\json\__init__.py", line 290, in load **kw) File "C:\Python27\li ...

  6. 在使用Ibatis查询数据返回时,报如下错误:java ibatis The error happened while setting a property on the result object

    问题: 在使用Ibatis查询数据返回时,报如下错误: [com.show.add.proxy.SqlMapClientTemplateProxy]com.ibatis.common.jdbc.exc ...

  7. log4net:ERROR XmlHierarchyConfigurator: Cannot find Property [File] to set object on [TF.Log.FileAppender]

    难受,香菇. 大概研究了两个多小时,搜了很多资料都没有很完美的答案,最后突然脑子就一闪一闪,才弄明白咋回事. log4net:ERROR XmlHierarchyConfigurator: Canno ...

  8. 从零开始——JSON ARRAY&JSON OBJECT

    在学习“基于角色的权限”的例子中,遇到了json object和json array,因此在一番学习之后对此要点进行粗略整理. 参考: https://my.oschina.net/u/2601842 ...

  9. python中读取json文件报错,TypeError:the Json object must be str, bytes or bytearray,not ‘TextIOWrapper’

    利用python中的json读取json文件时,因为错误使用了相应的方法导致报错:TypeError:the Json object must be str, bytes or bytearray,n ...

随机推荐

  1. 1.device-manage 优化

    一.当前简介 版本信息 device-manage:v1.0 mysql: 5.6.20 jdk : 1.8 Apache Maven 3.3.3 Spring4.2.5.RELEAS+SpingMV ...

  2. Delphi Timer组件

  3. 4.pca与梯度上升法

    (一)什么是pca pca,也就是主成分分析法(principal component analysis),主要是用来对数据集进行降维处理.举个最简单的例子,我要根据姓名.年龄.头发的长度.身高.体重 ...

  4. Type Trait 和 Type Utility

    所谓Type trait,提供了一种用来处理type 属性的办法,它是个template,可在编译期根据一个或多个template实参(通常也是type)产出一个type或者value. templa ...

  5. 标准C语言(5)

    无法预知的数字叫随机数,rand标准函数可以用来获得随机数,为了使用这个标准函数需要包含stdlib.h头文件 srand标准函数用来设置随机数种子,这个函数把一个整数作为种子使用不同的种子可以得到不 ...

  6. The Multilinear Structure of ReLU Networks

    两种非常常见的非线性单元:rectified linear units (ReLUs) 和 leaky ReLUs 我们选取binary hinge loss进行二分类 对于多分类,我们可以定义mul ...

  7. Head First设计模式 1 设计模式入门 策略模式 观察者模式

    关于基本的OOP特征: OOP的几大特征是抽象 继承 封装 多态. 我们把共同的部分抽象出来作为抽象类的存在,使用继承和接口来实现多态,然后私有的部分封装起来.一定程度上说,这些概念都是简单的设计模式 ...

  8. js 动态获取高度 设置距离

    var boxs = document.getElementById('m2-head');var Height = boxs.clientHeight||o.offsetHeight;console ...

  9. matplotlib 模块

    目录 matplotlib 模块 1.条形图 2.直方图 3.折线图 4.散点图+直线图 5.饼图 6. plot 函数参数 7.图像标注参数 matplotlib 模块 1.条形图 import m ...

  10. qt5--自定义控件封装

    视频教程地址:https://www.bilibili.com/video/av51766541/?p=30