Return json array from classic asp -
i returning html classic asp. here code :-
<% listfoldercontents(server.mappath("/userfiles")) %> <% sub listfoldercontents(path) dim fs, folder, file, item, url set fs = createobject("scripting.filesystemobject") set folder = fs.getfolder(path) response.write("<h2>"& folder.name &"</h2>") each item in folder.subfolders listfoldercontents(item.path) next response.write("<ul>") each item in folder.files response.write("<li><a>" & item.name & "</a></li>") next response.write("</ul>") end sub %>
but want return json array.i new ,can please guide me link or example.
thanks help.
well, have done in asp , isn't fun. need manually build json string formatted hierarchy looking for. can find tons of direction on formatting json in google.
here 1 example of formatted json http://json.org/example
{"menu": { "id": "file", "value": "file", "popup": { "menuitem": [ {"value": "new", "onclick": "createnewdoc()"}, {"value": "open", "onclick": "opendoc()"}, {"value": "close", "onclick": "closedoc()"} ] } }}
following that, asp specific thing recommend add code builds response.
response.contenttype="application/json"
Comments
Post a Comment