易截截图软件、单文件、免安装、纯绿色、仅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 UpdatePanel 控件概述


使用 ASP.NET UpdatePanel 控件可生成功能丰富的、以客户端为中心的 Web 应用程序。通过使用 UpdatePanel 控件,可以刷新页的选定部分,而不是使用回发刷新整个页面。这称为执行“部分页更新”。包含一个 ScriptManager 控件和一个或多个 UpdatePanel 控件的 ASP.NET 网页可自动参与部分页更新,而不需要自定义 ......

asp.net 将中文翻译成拼音(VS2008)

3个文件
code 类文件
 using System;
using System.Text;
namespace ConcreteMIS.Common.Chinese
{
    /// <summary>
    /// 汉字拼音声母计算类
    /// Write by WangZhenlong at 2003/11/29
    /// </summary>
   ......

ASP.net 类和属性的问题

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Sy ......

ASP.NET MVC中的验证

1.简单验证
在ASP.Net MVC中,验证是在Controller层,而错误呈现是在View层,Controller层是通过ModelState属性进行验证的,ModelState的状态是通过AddModelError()方法进行 添加的。
而在View层,是通过Html的辅助方法进行呈现的,这两个辅助方法分别是
Html.ValidationMessage()
Html.ValidationSummary()
Controller ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号