要有码的哦,谢谢了!
.net 怎么生成json文件啊?求种子
- 提问者网友:爱了却不能说
- 2021-05-02 08:34
- 五星知识达人网友:西岸风
- 2021-05-02 09:13
http://www.tg029.com/redirect.php?tid=2057&goto=lastpost
看看这个吧 是一个原理
- 1楼网友:纵马山川剑自提
- 2021-05-02 10:29
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.Script.Serialization;
public partial class sample3_sample3 : System.Web.UI.Page {
public class Car { private string name; private int age;
public string Name { get { return this.name; } set { this.name = value; } }
public int Age { get { return this.age; } set { this.age = value; } }
public Car ( string name, int age ) { this.name = name; this.age = age; }
}
protected void Page_Load(object sender, EventArgs e) { JavaScriptSerializer serializer = new JavaScriptSerializer (); this.Response.Write ( serializer.Serialize ( new Car ( "大众", 10 ) ) );
SortedList<string, object> values1 = new SortedList<string, object> (); values1.Add ( "Name", "小明" ); values1.Add ( "Age", 10 ); this.Response.Write ( serializer.Serialize ( values1 ) );
Hashtable values2 = new Hashtable (); values2.Add ( "Name", "大明" ); values2.Add ( "Age", 20 ); values2.Add ( "Birthday", new DateTime ( 2000, 1, 1 ) ); this.Response.Write ( serializer.Serialize ( values2 ) ); }
}
- 2楼网友:洒脱疯子
- 2021-05-02 10:17
什么意思 不太明白.....net 生成JSON?