IPhone Development notes (10) JSON serialization using. Net (server side)

Source: Internet
Author: User

The server side can be implemented using. net, just use the most common web form. aspx.

1. New item default. aspx

Add the following code to default. aspx:

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %><asp:literal id="lt_rtn" runat="server"></asp:literal> 

2. Go to the default. aspx. CS file.

Add the following code to the page_load method:

Student [] students = new student [4]; students [0] = new student (); students [1] = new student (); students [2] = new student (); students [3] = new student (); students [0]. number = "000000"; students [0]. name = "Kevin"; students [0]. sex = "male"; students [0]. age = "23"; students [1]. number = "111111"; students [1]. name = "Tom"; students [1]. sex = "male"; students [1]. age = "23"; students [2]. number = "222222"; students [2]. name = "Lily"; students [2]. sex = "female"; students [2]. age = "22"; students [3]. number = "333333"; students [3]. name = "John"; students [3]. sex = "male"; students [3]. age = "24"; javascriptserializer JS = new javascriptserializer (); lt_rtn.text = Js. serialize (students );

Create a new student class to encapsulate information. The Code is as follows:

public class Student{    public Student()    {     }    public string number;    public string name;    public string age;    public string sex;}

3. Run the experiment to check whether the webpage displays a JSON string. If it is displayed, the experiment is successful.

This article is learned from this great god. You can refer to this great god's blog. He introduced the knowledge of interaction between mobile terminals and servers.

Transport: http://www.cnblogs.com/flashpig/archive/2011/12/10/2283357.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.