How to use ASP JSON class files _ Application techniques

Source: Internet
Author: User
and to use a node to do a good analysis, the node path-level positioning. The best thing about JSON is that when you use it you can simply declare the data string as an object, and you can easily invoke the members of the object. It also facilitates the use of JavaScript directly by the client to invoke the data string generated by the assembly.

As anyone who uses ASP knows, ASP can use two types of scripting engines, namely VBScript and JScript. I didn't know anything about JScript at the time I was studying, and if I did, I don't think I need to be so bothered right now. Use JScript conversion for JSON data before you can use it in VBScript. Fortunately, the two scripting engines have their own advantages and disadvantages, and I have been working with VBScript for more than two years, although not strong, but also have been accustomed to some of the use of this method, formed its own code output specifications.

JSON's official class file is handy, and it's a flexible definition of the JSON data format you want to output. I will be the official class document to tidy up a bit, it is adjusted to become a very convenient form of their own it!
Even adjusted JSON class file, code file address:

ASP JSON class file source code

Code usage Examples:
1. Create a JSON object
Copy Code code as follows:

Set cnodejson=new Json_cls
Cnodejson.quotedvars=false ' Whether the object name is quoted
Cnodejson ("ID") =1
Cnodejson ("Name") = "Cloud.l"
Cnodejson ("blogname") = "Cloud.l Blog"
Set cnodejson=nothing

2. Create another object in the object
Copy Code code as follows:

Set cnodejson=new Json_cls
Cnodejson.quotedvars=false ' Whether the object name is quoted
Cnodejson ("ID") =1
Cnodejson ("Name") = "Cloud.l"
Cnodejson ("blogname") = "Cloud.l Blog"
Set Cnodejson ("SiteList") =new json_cls
Cnodejson ("SiteList") ("Blog") = "Http://www.jb51.net"
Cnodejson ("SiteList") ("CSDN") = "http://hi.csdn.net/lingyun410"
Set cnodejson=nothing

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.