Computer Learning Zone CLZ Access Excel Word Windows

Not all those who wander are lost.

-J. R. R. Tolkien
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Home > TechHelp > Directory > ASP > JSON < Paging | ASP Prove Human >
JSON
By Alex Hedley   12 years ago

JSON

In this tutorial you will learn how to create a JSON feed.

You need to make sure the page returns the correct Content Type. Add this as the first line.

Response.ContentType = "application/json"


 

I tried this but didn't have much look.

'Response.AddHeader('Content-Type', 'application/json')


 

I also added some Formatting changes to the data.

Function ApplyFormatting(strInput)

    strInput = Replace(strInput, Chr(13) , " ") 'vbCr

    strInput = Replace(strInput, Chr(10) , " ") 'vbCrLf

    'vbNewline  vbLf  vbTab  \n

    ApplyFormatting = strInput

End Function


 

There was also a need to remove the last comma (,) at the end of the ITEMS array. So I created a String, appended each item to that then at the end removed the last one.

You could connect to a Database and loop through a RecordSet.

Dim strItems

strItems = ""

 

If NOT rs.EOF Then rs.MoveFirst

While NOT rs.EOF

    strItems = strItems & "{"

    strItems = strItems & " ""id"" : " & ApplyFormatting(rs("BlogID")) & " "

    strItems = strItems & ","

    'Add any other items

    strItems = strItems & "}"

     

    strItems = strItems & ","

    'POST End

         

    'Repeat more Posts

    rs.MoveNext

'Loop

Wend

 

' Remove the last ","

strItems = Left(strItems, len(strItems)-1)

Response.Write(strItems)


 

You also need to escape any slashes, so in URLS a / needs to be \/ so it renders correctly.

 

Pre-Requisite

Members

No members extras today

Recommended Courses

Details

In this tutorial you will learn how to create a JSON feed.

Learn More

FREE Access Beginner Level 1
FREE Access Quick Start in 30 Minutes
Access Level 2 for just $1

Free Templates

TechHelp Free Templates
Blank Template
Contact Management
Order Entry & Invoicing
More Access Templates

Resources

Diamond Sponsors - Information on our Sponsors
Mailing List - Get emails when new videos released
Consulting - Need help with your database
Tip Jar - Your tips are graciously accepted
Merch Store - Get your swag here!

Questions?

Please feel free to post your questions or comments below or post them in the Forums.

KeywordsJSON

#asp, #classicasp, #help, #howto, #tutorial, #learn, #lesson, #training, #webdesign, #VBScript, classic ASP

Legacy

Start a NEW Conversation
 
Only students may post on this page. Click here for more information on how you can set up an account. If you are a student, please Log On first. Non-students may only post in the Visitor Forum.
 
Subscribe
Subscribe to JSON
Get notifications when this page is updated
 
 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 4/10/2026 9:23:26 PM. PLT: 1s
Keywords: json, FastTips ASP Fast Tips classic ASP  Page Tag: FORUMADMIN  PermaLink  JSON