csharp:Learn how to post JSON string to generic Handler using jQuery in ASP.Net C#.
/// <summary>
///參考: http://james.newtonking.com/json/help/index.html#
/// 塗聚文(Geovin Du) 20141228
/// 捷為工作室
/// </summary>
public partial class _Default : System.Web.UI.Page
{
Geovindu_TimeLineProjectInfo geovindu_TimeLineProjectInfo = new Geovindu_TimeLineProjectInfo();
Geovindu_TimeLineProjectBLL geovindu_TimeLineProjectBLL = new Geovindu_TimeLineProjectBLL();
Geovindu_TimeLineAssetInfo geovindu_TimeLineAssetProjectInfo = new Geovindu_TimeLineAssetInfo(); List<Geovindu_TimeLineDataInfo> selectGeovindu_TimeLineDataProject = new List<Geovindu_TimeLineDataInfo>(); Geovindu_TimeLineDataInfo geovindu_TimeLineDataInfo = new Geovindu_TimeLineDataInfo();
Geovindu_TimeLineAssetInfo geovindu_TimeLineAssetDataInfo = new Geovindu_TimeLineAssetInfo(); Geovindu_TimeLineAssetBLL geovindu_TimeLineAssetBLL = new Geovindu_TimeLineAssetBLL();
Geovindu_TimeLineDataBLL geovindu_TimeLineDataBLL = new Geovindu_TimeLineDataBLL();
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
try
{
geovindu_TimeLineProjectInfo = geovindu_TimeLineProjectBLL.SelectGeovindu_TimeLineProject(1);
geovindu_TimeLineAssetProjectInfo = geovindu_TimeLineAssetBLL.SelectGeovindu_TimeLineAssetProject(1);
selectGeovindu_TimeLineDataProject = geovindu_TimeLineDataBLL.SelectGeovindu_TimeLineDataProject(1);
for (int i = 0; i < selectGeovindu_TimeLineDataProject.Count; i++)
{
selectGeovindu_TimeLineDataProject[i].TimeLineDataAssetInfo = geovindu_TimeLineAssetBLL.SelectGeovindu_TimeLineAssetData(selectGeovindu_TimeLineDataProject[i].TimeDataID);
} //context.Response.ContentType = "text/plain";
//context.Response.Write("Hello World");
geovindu_TimeLineProjectInfo = geovindu_TimeLineProjectBLL.SelectGeovindu_TimeLineProject(1);
geovindu_TimeLineAssetProjectInfo = geovindu_TimeLineAssetBLL.SelectGeovindu_TimeLineAssetProject(1);
selectGeovindu_TimeLineDataProject = geovindu_TimeLineDataBLL.SelectGeovindu_TimeLineDataProject(1);
for (int i = 0; i < selectGeovindu_TimeLineDataProject.Count; i++)
{
selectGeovindu_TimeLineDataProject[i].TimeLineDataAssetInfo = geovindu_TimeLineAssetBLL.SelectGeovindu_TimeLineAssetData(selectGeovindu_TimeLineDataProject[i].TimeDataID);
} JObject rss =
new JObject(
new JProperty("timeline",
new JObject(
new JProperty("headline", geovindu_TimeLineProjectInfo.TimeHeadline),
new JProperty("type", geovindu_TimeLineProjectInfo.TimeType),
new JProperty("text", geovindu_TimeLineProjectInfo.TimeText),
new JProperty("startDate", geovindu_TimeLineProjectInfo.TimeStartDate.ToString("yyyy,MM,dd")),
new JProperty("asset",
new JObject(
new JProperty("media", geovindu_TimeLineAssetProjectInfo.TimeAssetMedia),
new JProperty("credit", geovindu_TimeLineAssetProjectInfo.TimeAssetCredit),
new JProperty("caption", geovindu_TimeLineAssetProjectInfo.TimeAssetCaption))),
new JProperty("date",
from p in selectGeovindu_TimeLineDataProject
orderby p.TimeDataHeadline
select new JObject(
new JProperty("startDate", p.TimeDataStartDate.ToString("yyyy,MM,dd")),
new JProperty("headline", p.TimeDataHeadline),
new JProperty("text", p.TimeDataText),
new JProperty("asset",
new JObject(
//geovindu_TimeLineAssetDataInfo=geovindu_TimeLineAssetBLL.SelectGeovindu_TimeLineAssetData(p.TimeDataID)
new JProperty("media", p.TimeLineDataAssetInfo.TimeAssetMedia),
new JProperty("credit", p.TimeLineDataAssetInfo.TimeAssetCredit),
new JProperty("caption", p.TimeLineDataAssetInfo.TimeAssetCaption) )))))));
Response.Write(rss.ToString());
File.WriteAllText(Server.MapPath("geovindu.json"), rss.ToString()); }
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
} }
}
}
csharp:Learn how to post JSON string to generic Handler using jQuery in ASP.Net C#.的更多相关文章
- Array(数组)与Json String (Json字符串) 的相互转换
1.Array转换成Json String function jsonToString(arr) { var s = ""; ...
- json string 与object 之间的转化
1.将json string转化成object 1: public static T GetObjectFromJson<T>(string jsonString) 2: { 3: Dat ...
- perl malformed JSON string, neither tag, array, object, number, string or atom, at character offset
[root@wx03 ~]# cat a17.pl use JSON qw/encode_json decode_json/ ; use Encode; my $data = [ { 'name' = ...
- Jackson将json string转为Object,org.json读取json数组
从json文件读取json string或者自定义json string,将其转为object.下面采用的object为map,根据map读取json的某个数据,可以读取第一级的数据name,后来发现 ...
- Convert List<Entity> to Json String.
public static string ToJson(this object obj, string datetimeformats) { var timeConverter = new I ...
- 解决 Jackson反序列化 Unexpected token ... , expected VALUE_STRING: need JSON String that contains type id (for subtype of ...)
首先检查是否是 objectMapper.enableDefaultTyping(); 的受害者.优先考虑删除该配置. 使用Jackson把数组的json字符串反序列化为List时候报了个JsonMa ...
- You're trying to decode an invalid JSON String JSON返回有解析问题
SpringMVC架构的web程序,通常用map返回消息在浏览器中显示,但是实际中报下列错误“”You're trying to decode an invalid JSON String“返回的字符 ...
- How to remove null value in json string
Hi I'm using the below class Public List<string> name; Public List<string> midname; Once ...
- FastJSON 简介及其Map/JSON/String 互转
在日志解析,前后端数据传输交互中,经常会遇到 String 与 map.json.xml 等格式相互转换与解析的场景,其中 json 基本成为了跨语言.跨前后端的事实上的标准数据交互格式.应该来说各个 ...
随机推荐
- 不同的color-model
RGB color mode YIQ color mode Y: brightness,亮度 I: In-phase,色彩从橙色到青色 -Q: Quadrature-phase, 色彩从紫色到黄绿色 ...
- svn命令行的使用
只是说一下,svn平时工作时常用的命令 1.svn delete 目录 删除svn版本里的相关目录 2.svn add 目录 将本地的目录添加到svn版本信息里 3.svn commit 目录 提交s ...
- 5104 I-country
5104 I-country 在 N*M 的矩阵中,每个格子有一个权值,要求寻找一个包含 K 个格子的凸连通块(连通块中间没有空缺,并且轮廓是凸的,如书中图片所示),使这个连通块中的格子的权值和最大. ...
- Linux 内存监控
1.按照内存使用方式排序 top 之后使用 shift + m 那么top按照内存使用从大到小进行排列,使用 shift + P 表示按照CPU进行排序. bigfish 1118m 438m 30m ...
- mask layer的遮罩层
1. layer层 mask 遮罩效果 //渐变层 CAGradientLayer *gradientLayer = [CAGradientLayer layer]; gradientLayer.fr ...
- 数据库--sql文件
sql 脚本是包含一到多个 sql 命令的 sql 语句集合 使用 Linux: mysqldump 命令 1.导出数据和表结构: mysqldump -u 用户名 -p 数据库名称 > nam ...
- 接口自动化之unittest初探
最近几天苦心钻研unittest,终于略有所得,所以想来跟大家分享一下.有关python和unittest的基础知识部分就不在一一细说,相信各位也不是小白了.如果需要我整理基础知识,欢迎留言,我会看情 ...
- 论文阅读 | ExtremeNet:Bottom-up Object Detection by Grouping Extreme and Center Points
相关链接 论文地址:https://arxiv.org/abs/1901.08043 论文代码:https://github.com/xingyizhou/ExtremeNet 概述 ExtremeN ...
- odoo 的一些orm 操作
1.基础文件及目录结构 在认识odoo ORM框架前,先介绍一下odoo中模块目录结构. data:存放模块预制数据 i18n:存放国际化文件 models:存放模型等py代码 securit ...
- Linux I2C驱动程序设计
1. Linux I2C子系统架构 (1)I2C核心(I2C-Core):I2C 总线和I2C 设备驱动的中间枢纽,它提供了I2C 总线驱动和设备驱动的注册.注销方法等 (2)I2C控制器驱动(ada ...