Newtonsoft.Json.Linq对象读取DataSet数据
Newtonsoft.Json.Linq对象读取DataSet数据:
private void button4_Click(object sender, EventArgs e)
{
DataTable dt = new DataTable("t");
dt.Columns.Add("a");
dt.Columns.Add("b");
dt.Rows.Add("1", "11");
dt.Rows.Add("2", "22");
DataSet ds = new DataSet();
ds.Tables.Add(dt);
dt = dt.Copy();
dt.TableName = "t2";
ds.Tables.Add(dt);
string str = Newtonsoft.Json.JsonConvert.SerializeObject(ds);
object obb = Newtonsoft.Json.JsonConvert.DeserializeObject(str);
//string ss= obb["a"];
JObject ob = (JObject)(obb);
JArray ss = (JArray) ob["t"];
JObject jo = (JObject)ss[0];
string mm = jo["a"].ToString();
}
private void button5_Click(object sender, EventArgs e)
{
Dictionary<string, string> dict = new Dictionary<string, string>();
dict["a"] = "111";
dict["b"] = "dsf";
dict["c"] = "dssssf";
string str = Newtonsoft.Json.JsonConvert.SerializeObject(dict);
object obb = Newtonsoft.Json.JsonConvert.DeserializeObject(str);
//string ss= obb["a"];
JObject ob = ( JObject)(obb);
string mm = ob["a"].ToString();
}
Newtonsoft.Json.Linq对象读取DataSet数据的更多相关文章
- Newtonsoft.Json.Linq.JObject 遍历验证每个属性内容
业务需求,拦截器验证每个请求inputstream(实际是application/json流)的数据,但是json反序列化实体格式不同. var req = filterContext.Request ...
- Newtonsoft.Json.Linq
var json = "{\"name\":\"ok1\",\"sex\":\"man\"}"; / ...
- Newtonsoft.Json.Linq 常用方法总结
目录 1.Entity to Json 1.1.准备工作 1.2.Entity to Json 1.3.Json to Entity 2.Linq To Json 2.1.创建对象 2.2.从 Jso ...
- Newtonsoft.Json 把对象转换成json字符串
var resultJson = new { records = rowCount, page = pageindex, //总页数=(总页数+页大小-1)/页大小 total = (rowCount ...
- Newtonsoft.Json 通过 JObject 读取 json对像 超简单
/* json 格式的字符串解析 格式化 { "input": { "size": 193156, "type": "image/ ...
- 遍历Newtonsoft.Json.Linq.JObject
JObject 遍历: 引用命名空间:using Newtonsoft.Json.Linq; JObject _jObject = JObject.Parse("{'ID':'001','M ...
- Can not add Newtonsoft.Json.Linq.JValue to Newtonsoft.Json.Linq.JObject.
https://blog.csdn.net/zhouyingge1104/article/details/83307637 C#项目中使用NewtonSoft.json,报错提示: Can not a ...
- asp.net core 3.0 JObject The collection type 'Newtonsoft.Json.Linq.JObject' is not supported
在asp.net core 3.0 中,如果直接在Controller中返回 Jobject 类型,会抛出如下错误: The collection type 'Newtonsoft.Json.Linq ...
- json+一般处理程序读取数据库数据
一般处理程序的语法结构 string jsoncallback = context.Request["jsoncallback"]; 声明变量 前台传值使用 stri ...
随机推荐
- 借助form表单向web服务器发送消息
form表单是常用的,在网页浏览器中 用户点击的请求经htto协议发送回web容器,请求处理 建立用户的页面 <!DOCTYPE html> <html> <head&g ...
- art-template模板应用
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...
- 【three.js练习程序】创建简单物理地形
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...
- .NET笔试题集(五)
转载于:http://www.cnblogs.com/ForEvErNoME/archive/2012/09/15/2684938.html 1.什么是受管制的代码? 答:unsafe:非托管代码.不 ...
- Oracle EBS FA 资产编号跳号
- SQL Server自动备份 备份到本地或者远程服务器
0.1 在SQLServer2008 --> 备份数据库 --> 安全 --> 新建用户 --> 用户名 选择该windows用户 (确保 --> 机器名/人名 --&g ...
- 俩表之间的添加Sql
insert into 表3(字段1,字段2) select 表1.UserName,表2.GroupName from 表1,表2 where ...
- python基础学习2
一.算数运算符 +加法,-减法,*乘法,/除法,//地板除,%求余,**幂运算. 二.逻辑运算符 非not.且and.或or.优先级依次为not,and,or. 三.print()end结尾 prin ...
- python解析式
一.列表解析式 列表解析是外面一对中括号,它返回的是列表. 一般形式为:[expr for item in itratoble] print([i+1 for i in range(10)]) #结果 ...
- October 16th 2017 Week 42nd Monday
The more decisions that you are forced to make alone, the more you are aware of your freedom to choo ...