본문 바로가기

Dev/ASP

[ASP] JSON 형으로 리스트 만들기

반응형

Link : http://code.google.com/p/aspjson/

 

Default

<!--#include file="JSON_2.0.4.asp"-->
<%
    Dim member Set member = jsObject()  
    member("name") = "ollagaza"
    member("age") = "15"
    member("message") = "ollagaza's story" 
    member.Flush
%> 
- RESULT
{"name":"ollagaza","age":"15","message":"ollagaza's story"}


SQL Query

<!--#include file="JSON_2.0.4.asp"-->
<!--#include file="JSON_UTIL_0.1.1.asp"--> 
<% 
    QueryToJSON(dbconn, "SELECT name, age FROM members ").Flush 
%> 
- RESULT
[{"name":"ollagaza","age":"15"},{"name":"baby","age":"20"     } ]


Multi Dimensional Arrays

<!--#include file="JSON_2.0.4.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) 
%> 
- RESULT
[{"zero - zero","zero - one"},{"one - zero","one - one"}]

 

JSON_2.0.4.aspJSON_UTIL_0.1.1.asp


반응형

태그