ASP的JSON类使用方法
ASP #json #类2012-05-11 09:18
前面我们介绍了ASP的JSON类 http://yige.org/p/188 ,现在我们来举例,学会用JSON类。
Hello World!
示例:
<!--#include file="JSON_latest.asp"-->
<%
Dim member
Set member = jsObject()
member("name") = "Tuğrul"
member("surname") = "Topuz"
member("message") = "Hello World"
member.Flush
%>
输出:
{"name":"Tu\u011Frul","surname":"Topuz","message":"Hello World"}
SQL Queries
示例:
<!--#include file="JSON_latest.asp"-->
<!--#include file="JSON_UTIL_latest.asp"-->
<%
QueryToJSON(dbconn, "SELECT name, surname FROM members WHERE age < 30").Flush
%>
输出:
[
{
"name":"ali",
"surname":"osman"
},
{
"name":"mahmut",
"surname":"\u00E7\u0131nar"
}
]
Multi Dimensional Arrays
示例:
<!--#include file="JSON_latest.asp"-->
<%
Dim a(1,1)
a(0,0) = "zero - zero"
a(0,1) = "zero - one"
a(1,0) = "one - zero"
a(1,1) = "one - one"
Response.Write toJSON(a)
%>
输出:
[["zero - zero","zero - one"],["one - zero","one - one"]]
相关文章
- ASP的JSON类 2012/05/11
- ASP实现注册登录的代码 2012/05/11
- ASP实现ajax注册即时提示代码 2012/05/10
- ASP多级联动菜单效果代码 2012/05/10
- ASP提高页面执行效率的方法 2012/05/10
- ASP删除数据并同时删除图片的代码 2012/05/10
- ASP的Err.Number错误描述 2012/05/10
- ASP实现Ajax跨域 2012/05/10
- ASP实现文件直接下载 2012/05/09
- ASP实现批量插入数据 2012/05/09