ASPJSON is a free to use project for generating and reading JSON data into a classic ASP object.

The class can be used for reading a string of JSON data as well as writing JSON output from an AJAX file.
Below are 2 simple examples of both.

Thank you for submitting the bug. We'll be looking into this soon.

Please feel free to give or to


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!--#include virtual="/aspJSON1.17.asp" -->
<%
Set oJSON = New aspJSON

With oJSON.data

    .Add "familyName", "Smith"                      'Create value
    .Add "familyMembers", oJSON.Collection()

    With oJSON.data("familyMembers")

        .Add 0, oJSON.Collection()                  'Create object
        With .item(0)
            .Add "firstName", "John"
            .Add "age", 41
        End With

        .Add 1, oJSON.Collection()
        With .item(1)
            .Add "firstName", "Suzan"
            .Add "age", 38
            .Add "interests", oJSON.Collection()    'Create array
            With .item("interests")
                .Add 0, "Reading"
                .Add 1, "Tennis"
                .Add 2, "Painting"
            End With
        End With

        .Add 2, oJSON.Collection()
        With .item(2)
            .Add "firstName", "John Jr."
            .Add "age", 2.5
        End With

    End With

End With

Response.Write oJSON.JSONoutput()                   'Return json string
%>
        
[OUTPUT]
{ "familyName": "Smith", "familyMembers": [ { "firstName": "John", "age": 41 }, { "firstName": "Suzan", "age": 38, "interests": [ "Reading", "Tennis", "Painting" ] }, { "firstName": "John Jr.", "age": 2.5 } ] }

Release 1.17 Februari 2014
- Efficiency improvement large data

Release 1.15 Februari 2014
- Trailing tabs fixed

Release 1.14 Februari 2014
- Colon value within string bug fixed

Release 1.13 December 2013
- Encoded data fix
- Now possible to load directly from a URL.
   For example: oJSON.loadJSON("http://www.aspjson.com/jsonstream.asp")

Release 1.12 June 2013
- vbCrLf fix
- Compatible with Option Explicit
- JSON escape characters