<%@ Language=VBScript %> <% Response.ContentType = "text/html" ' VBScript IIf equivalent function Function IIf(condition, trueValue, falseValue) If condition Then IIf = trueValue Else IIf = falseValue End If End Function %> ๐Ÿฐ RabbitJSON v2.1.1 - Comprehensive Demo

๐Ÿฐ RabbitJSON v2.1.1 - Comprehensive Demo

All-in-One JSON Processing Demonstration

File Loading โ€ข HTTP Loading โ€ข Path Access โ€ข Serialization โ€ข Performance

<% ' =========================================== ' PERFORMANCE TRACKING & INITIALIZATION ' =========================================== Dim startTime, parseTime, endTime, totalTime Dim json, parsedData, testResults startTime = Timer Set json = CreateRabbitJSON() Set testResults = Server.CreateObject("Scripting.Dictionary") ' Demo configuration Dim demoSampleFile, demoApiUrl1, demoApiUrl2 demoSampleFile = "sample-data.json" demoApiUrl1 = "https://jsonplaceholder.typicode.com/posts/1" demoApiUrl2 = "https://api.github.com/users/octocat" %>
๐Ÿ“ File Loading
๐ŸŒ HTTP Loading
๐Ÿ“Š Data Analysis
โšก Performance

๐Ÿ“ JSON File Loading Demonstration

<% ' File Loading Test Dim fileStartTime, fileLoadTime, fileParseTime fileStartTime = Timer Dim fso, jsonFile, jsonContent, fileSize Set fso = Server.CreateObject("Scripting.FileSystemObject") On Error Resume Next Set jsonFile = fso.OpenTextFile(Server.MapPath(demoSampleFile), 1) If Err.Number = 0 Then jsonContent = jsonFile.ReadAll() jsonFile.Close() fileSize = Len(jsonContent) fileLoadTime = Timer ' Parse the loaded JSON Set parsedData = json.Parse(jsonContent) fileParseTime = Timer If Not (parsedData Is Nothing) And json.LastError = "" Then ' Successful parse - test access ' Test data access to verify parse success Dim testCompanyName ' Test data access to verify parse success testCompanyName = json.GetValue("company.name", "") If testCompanyName <> "" Then testResults("fileLoad") = True testResults("fileLoadTime") = (fileLoadTime - fileStartTime) * 1000 testResults("fileParseTime") = (fileParseTime - fileLoadTime) * 1000 testResults("fileSize") = fileSize Response.Write "
" Response.Write "

โœ… File Loading & Parse Success

" Response.Write "File: " & demoSampleFile & "
" Response.Write "Size: " & FormatNumber(fileSize, 0) & " characters
" Response.Write "Load Time: " & FormatNumber(testResults("fileLoadTime"), 2) & "ms
" Response.Write "Parse Time: " & FormatNumber(testResults("fileParseTime"), 2) & "ms
" Response.Write "Root Sections: " & UBound(json.GetKeys()) + 1 & "
" Response.Write "Data Verification: " & testCompanyName & "" Response.Write "
" Else testResults("fileLoad") = False Response.Write "
" Response.Write "

โŒ Data Access Failed

" Response.Write "Parse Status: Object created but data access failed
" Response.Write "Error: " & json.LastError & "
" Response.Write "Debug: Company name test returned empty" Response.Write "
" End If Else testResults("fileLoad") = False Response.Write "
" Response.Write "

โŒ JSON Parsing Failed

" Response.Write "Error: " & json.LastError & "
" If parsedData Is Nothing Then Response.Write "Parse Result: Nothing object
" Else Response.Write "Parse Result: Object created
" End If Response.Write "JSON Preview: " & Left(jsonContent, 100) & "..." Response.Write "
" End If Else testResults("fileLoad") = False Response.Write "
" Response.Write "

โŒ File Loading Failed

" Response.Write "File: " & demoSampleFile & "
" Response.Write "Error: " & Err.Description Response.Write "
" End If On Error Goto 0 Set fso = Nothing %> <% If testResults("fileLoad") Then %>

๐Ÿ“‹ Quick Data Preview

Company: <%= json.GetValue("company.name", "N/A") %>

Employees: <%= FormatNumber(json.GetValue("company.employees", 0), 0) %>

Founded: <%= json.GetValue("company.founded", 0) %>

Location: <%= json.GetValue("company.headquarters.city", "N/A") %>, <%= json.GetValue("company.headquarters.country", "N/A") %>

<% Else %>

โš ๏ธ Data Preview Unavailable

Parse Status: <% If testResults.Exists("fileLoad") And testResults("fileLoad") Then Response.Write "Success" Else Response.Write "Failed" End If %>

Last Error: <%= json.LastError %>

<% If testResults("fileLoad") Then %>

Debug Info: File loaded and parsed but data access failing

<% End If %>
<% End If %>

๐ŸŒ HTTP URL Loading Demonstration

๐Ÿ”— Test 1: JSONPlaceholder API

<% Dim http1StartTime, http1EndTime, json1, parsed1 http1StartTime = Timer Set json1 = CreateRabbitJSON() Set parsed1 = json1.Parse(demoApiUrl1) http1EndTime = Timer If Not (parsed1 Is Nothing) Then testResults("api1Load") = True testResults("api1Time") = (http1EndTime - http1StartTime) * 1000 Set json1.Data = parsed1 Response.Write "
" Response.Write "

โœ… SUCCESS - JSONPlaceholder API

" Response.Write "URL: " & demoApiUrl1 & "
" Response.Write "Response Time: " & FormatNumber(testResults("api1Time"), 2) & "ms
" Response.Write "Data Keys: " & UBound(json1.GetKeys()) + 1 & "" Response.Write "
" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "
FieldValue
Post ID" & json1.GetValue("id", "N/A") & "
User ID" & json1.GetValue("userId", "N/A") & "
Title" & Left(json1.GetValue("title", "N/A"), 60) & "...
Body Length" & Len(json1.GetValue("body", "")) & " chars
" Else testResults("api1Load") = False Response.Write "
" Response.Write "

โŒ FAILED - JSONPlaceholder API

" Response.Write "Error: " & json1.LastError Response.Write "
" End If %>

๐Ÿ”— Test 2: GitHub API

<% Dim http2StartTime, http2EndTime, json2, parsed2 http2StartTime = Timer Set json2 = CreateRabbitJSON() Set parsed2 = json2.Parse(demoApiUrl2) http2EndTime = Timer If Not (parsed2 Is Nothing) Then testResults("api2Load") = True testResults("api2Time") = (http2EndTime - http2StartTime) * 1000 Set json2.Data = parsed2 Response.Write "
" Response.Write "

โœ… SUCCESS - GitHub API

" Response.Write "URL: " & demoApiUrl2 & "
" Response.Write "Response Time: " & FormatNumber(testResults("api2Time"), 2) & "ms
" Response.Write "Data Keys: " & UBound(json2.GetKeys()) + 1 & "" Response.Write "
" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "
FieldValue
Username" & json2.GetValue("login", "N/A") & "
Name" & json2.GetValue("name", "N/A") & "
Public Repos" & FormatNumber(json2.GetValue("public_repos", 0), 0) & "
Followers" & FormatNumber(json2.GetValue("followers", 0), 0) & "
Following" & FormatNumber(json2.GetValue("following", 0), 0) & "
" Else testResults("api2Load") = False Response.Write "
" Response.Write "

โŒ FAILED - GitHub API

" Response.Write "Error: " & json2.LastError Response.Write "
" End If %>

๐Ÿ“„ Test 3: Backward Compatibility (JSON String)

<% Dim compatStartTime, compatEndTime, json3, parsed3 compatStartTime = Timer Dim compatJsonStr compatJsonStr = "{""test"":""RabbitJSON v2.1.1"",""features"":[""file-loading"",""http-loading"",""path-access""],""version"":2.11,""ready"":true}" Set json3 = CreateRabbitJSON() Set parsed3 = json3.Parse(compatJsonStr) compatEndTime = Timer If Not (parsed3 Is Nothing) Then testResults("compatLoad") = True testResults("compatTime") = (compatEndTime - compatStartTime) * 1000 Set json3.Data = parsed3 Response.Write "
" Response.Write "

โœ… SUCCESS - Backward Compatibility

" Response.Write "Input: Direct JSON String
" Response.Write "Parse Time: " & FormatNumber(testResults("compatTime"), 2) & "ms
" Response.Write "Features: URL detection did not interfere with JSON parsing" Response.Write "
" Else testResults("compatLoad") = False Response.Write "
" Response.Write "

โŒ FAILED - Backward Compatibility

" Response.Write "Error: " & json3.LastError Response.Write "
" End If %>
<% If testResults("fileLoad") Then %>

๐Ÿ“Š Comprehensive Data Analysis

๐Ÿข Company Information

<%= json.GetValue("company.name", "N/A") %>

Company

<%= FormatNumber(json.GetValue("company.employees", 0), 0) %>

Employees

<%= json.GetValue("company.founded", 0) %>

Founded

<%= json.GetValue("company.headquarters.city", "N/A") %>

Headquarters

๐Ÿ“ฆ Products Portfolio

<% For i = 0 To 1 Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Next %>
Product Category Price Downloads Rating Open Source
" & json.GetValue("products." & i & ".name", "N/A") & "" & json.GetValue("products." & i & ".category", "N/A") & "$" & json.GetValue("products." & i & ".price", 0) & "" & FormatNumber(json.GetValue("products." & i & ".downloads.total", 0), 0) & "" & json.GetValue("products." & i & ".ratings.average", 0) & "/5" & json.GetValue("products." & i & ".isOpenSource", False) & "

๐Ÿ“ˆ Analytics Dashboard

<%= FormatNumber(json.GetValue("analytics.traffic.dailyVisitors", 0), 0) %>

Daily Visitors

<%= FormatNumber(json.GetValue("analytics.traffic.monthlyVisitors", 0), 0) %>

Monthly Visitors

<%= FormatNumber(json.GetValue("analytics.traffic.pageViews", 0), 0) %>

Page Views

<%= FormatNumber(json.GetValue("analytics.traffic.bounceRate", 0) * 100, 1) %>%

Bounce Rate

๐ŸŒ Geographic Distribution

<% For i = 0 To 4 Response.Write "" Response.Write "" Response.Write "" Response.Write "" Response.Write "" Next %>
Country Percentage Visitors
" & json.GetValue("analytics.geographical.topCountries." & i & ".country", "N/A") & "" & json.GetValue("analytics.geographical.topCountries." & i & ".percentage", 0) & "%" & FormatNumber(json.GetValue("analytics.geographical.topCountries." & i & ".visitors", 0), 0) & "

๐Ÿ–ฅ๏ธ System Information

Component Value
Operating System<%= json.GetValue("systemInfo.server.os", "N/A") %>
IIS Version<%= json.GetValue("systemInfo.server.iisVersion", "N/A") %>
ASP Version<%= json.GetValue("systemInfo.server.aspVersion", "N/A") %>
VBScript Version<%= json.GetValue("systemInfo.server.vbscriptVersion", "N/A") %>
CPU Model<%= json.GetValue("systemInfo.server.cpu.model", "N/A") %>
CPU Cores<%= json.GetValue("systemInfo.server.cpu.cores", 0) %>
Total Memory<%= json.GetValue("systemInfo.server.memory.total", "N/A") %>
Available Memory<%= json.GetValue("systemInfo.server.memory.available", "N/A") %>

๐Ÿงช Special Data Types Testing

Unicode: <%= json.GetValue("testData.specialCharacters", "N/A") %>

Emojis: <%= json.GetValue("testData.unicodeEmojis", "N/A") %>

Large Number: <%= json.GetValue("testData.numbers.large", 0) %>

Scientific: <%= json.GetValue("testData.numbers.scientific", 0) %>

Boolean True: <%= json.GetValue("testData.booleans.trueValue", False) %>

Boolean False: <%= json.GetValue("testData.booleans.falseValue", True) %>

<% Dim nullValue nullValue = json.GetValue("testData.nullValue", "NOT_NULL") If IsNull(nullValue) Then Response.Write "

Null Value: null (correctly parsed)

" Else Response.Write "

Null Value: Error - not null!

" End If %>
<% Else %>

โš ๏ธ Data Analysis Unavailable

Please ensure the file loading was successful to view data analysis.

<% End If %>
<% endTime = Timer totalTime = (endTime - startTime) * 1000 %>

โšก Performance Analysis & Benchmarks

<%= FormatNumber(totalTime, 2) %>ms

Total Demo Time

<% If testResults.Exists("fileLoadTime") Then %>

<%= FormatNumber(testResults("fileLoadTime"), 2) %>ms

File Load Time

<% End If %> <% If testResults.Exists("api1Time") Then %>

<%= FormatNumber(testResults("api1Time"), 2) %>ms

API 1 Response

<% End If %> <% If testResults.Exists("api2Time") Then %>

<%= FormatNumber(testResults("api2Time"), 2) %>ms

API 2 Response

<% End If %>

๐Ÿ“Š Detailed Performance Metrics

<% If testResults.Exists("fileLoadTime") Then %> <% End If %> <% If testResults.Exists("api1Time") Then %> <% End If %> <% If testResults.Exists("api2Time") Then %> <% End If %> <% If testResults.Exists("compatTime") Then %> <% End If %>
Operation Time (ms) Status Details
File Loading <%= FormatNumber(testResults("fileLoadTime"), 2) %> <%= IIf(testResults("fileLoad"), "โœ… Success", "โŒ Failed") %> <%= FormatNumber(testResults("fileSize"), 0) %> characters
File Parsing <%= FormatNumber(testResults("fileParseTime"), 2) %> <%= IIf(testResults("fileLoad"), "โœ… Success", "โŒ Failed") %> JSON structure analysis
HTTP API 1 <%= FormatNumber(testResults("api1Time"), 2) %> <%= IIf(testResults("api1Load"), "โœ… Success", "โŒ Failed") %> JSONPlaceholder API
HTTP API 2 <%= FormatNumber(testResults("api2Time"), 2) %> <%= IIf(testResults("api2Load"), "โœ… Success", "โŒ Failed") %> GitHub API
JSON String Parse <%= FormatNumber(testResults("compatTime"), 2) %> <%= IIf(testResults("compatLoad"), "โœ… Success", "โŒ Failed") %> Backward compatibility

๐Ÿ” Performance Insights

<% If testResults.Exists("fileSize") And testResults.Exists("fileParseTime") Then %>

Parse Speed: <%= FormatNumber(testResults("fileSize") / testResults("fileParseTime"), 0) %> characters/ms

<% End If %>

Memory Usage: Automatic cleanup enabled

Error Handling: Comprehensive error detection

URL Detection: Smart HTTP/HTTPS recognition

๐Ÿ’ป Usage Code Examples

RabbitJSON v2.1.1 Usage Examples: ' File Loading Example Set json = CreateRabbitJSON() Set data = json.Parse("sample-data.json") ' File path companyName = json.GetValue("company.name", "") ' HTTP URL Loading Example Set apiData = json.Parse("https://api.github.com/users/octocat") ' HTTP URL username = json.GetValue("login", "") ' Regular JSON String (Backward Compatible) Set localData = json.Parse("{""key"":""value""}") ' JSON string value = json.GetValue("key", "") ' Path-based Data Access employeeCount = json.GetValue("company.employees", 0) latitude = json.GetValue("company.headquarters.address.coordinates.latitude", 0) firstProductName = json.GetValue("products.0.name", "") ' Data Manipulation json.SetValue "demo.timestamp", Now() json.SetValue "demo.processed", True hasValue = json.HasValue("analytics.traffic") ' Serialization compactJson = json.StringifyCompact(json.Data) formattedJson = json.Stringify(json.Data, 2)

๐ŸŽ‰ RabbitJSON v2.1.1 - Comprehensive Demo Complete!

Demonstrated Features:

โœ… Core Features:
  • JSON file loading
  • HTTP URL loading
  • Path-based data access
  • Data serialization
โœ… Data Types:
  • String, Number, Boolean
  • Null values
  • Objects and Arrays
  • Unicode support
โœ… Performance:
  • Fast parsing engine
  • Memory efficient
  • Error handling
  • Auto cleanup

Total Demo Time: <%= FormatNumber(totalTime, 2) %>ms

<% ' Cleanup Set json = Nothing Set json1 = Nothing Set json2 = Nothing Set json3 = Nothing Set parsedData = Nothing Set parsed1 = Nothing Set parsed2 = Nothing Set parsed3 = Nothing Set testResults = Nothing %>