易截截图软件、单文件、免安装、纯绿色、仅160KB

JSON Serialization and Deserialization in ASP.Net


    
JSON Serialization and Deserialization in ASP.Net
 
I was looking around for a simple example which would just do an object serialization to a JSON format, and then deserializing back to the original object. I found few examples on MSDN, but did seem to be too long to try. Here I've given a simple code which would make your understanding easy, and simpler.
 
 
What is JSON?
 
JSON is another format of expressing data, just like XML. But, JSON is very simpler than XML, and tiny than XML. So, it is becoming popular in the web world to choose the JSON notation over XML since JSON notation are usually shorter, and less data to be transmitted if at all they were to be.
 
Okay, I understood a little about JSON. Give me an example!
 
I know an example will get your understanding much better. Below is a simple example of how an object can be expressed in JSON notation. Let's take a classical example of a Person object, and expressing myself as an object.
{
   "firstName": "Rakki",
   "lastName":"Muthukumar",
   "department":"Microsoft PSS",
   "address": {
      "addressline1": "Microsoft India GTSC",
      "addressline2": "PSS - DSI",
      "city": "Bangalore",
      "state": "Karnataka",
      "country": "India",
      "pin": 560028
   }
   "technologies": ["IIS", "ASP.NET","JavaScript","AJAX"]
}
In the above example, address is another object inside my Person, and technologies is an array or strings.
 
Express this as a simple .NET class, please!
 
Here is a simple example.
public class Address
{
    public string addressline1, addressline2, city, state, country;
    public int pin;
}
 
public class Person
{
  


相关文档:

浅谈ASP.net安全编程

在Web编程过程中,存在着很多安全隐患。比如在以前的ASP版本中,Cookie为访问者和编程者都提供了方便,并没有提供加密的功能。打开IE浏览器,选择“工具”菜单里的“Internet选项”,然后在弹出的对话框里单击“设置”按钮,选择“查看文件”按钮,在弹出的窗口中,就会显示硬盘里 ......

ASP.NET 演练:Timer 控件简介


      在本演练中,将使用三个 ASP.NET AJAX 服务器控件(ScriptManager 控件、UpdatePanel 控件和 Timer 控件)按固定的时间间隔更新部分网页。通过将这些控件添加到网页上,可消除在每次回发时刷新整个页面的需要。将只需更新 UpdatePanel 控件的内容。
1、在 Microsoft Visual Studio 2005 ......

ASP.NET页面缓存的几点体会

ASP.NET页面缓存的几点体会
尽管本文的作者写的很简单,但是相信通过这些文字,还是能对大家了解ASP.NET页面缓存有很大的帮助。
前几天遇到个问题,百思不得其解。后来查阅了一些资料心里才有了点思路。把自己遇到的问题记录下来希望能给其他的园友一些帮助吧。
事情是这样的。我的一个ASP.NET页面用window.open导航后 ......

ASP.NET中常用的三十三种代码

1. 打开新的窗口并传送参数:
传送参数:
response.write("<script>window.open('*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"')</script>")
接收参数:
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
2.为按钮添加对话框
Button1.Attributes.Add("o ......

asp.net 获取本周、本月第一天和最后一天

 DateTime dt = DateTime.Now;
 //本月第一天时间   
DateTime dt_First = dt.AddDays(-(dt.Day) + 1);
 Label1.Text = dt_First.ToString("yyyy-MM-dd");
//将本月月数+1 
DateTime dt2 = dt.AddMonths(1);
//本月最后一天时间  
DateTime dt_Last = dt2.AddDays( ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号