Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8016691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:36:40+00:00 2026-06-04T20:36:40+00:00

I am getting a JSON result in ASP Classic like this: <script language=JScript runat=server

  • 0

I am getting a JSON result in ASP Classic like this:

<script language="JScript" runat="server" src="json2.js"></script>
<%
Response.ContentType = "text/html"

Dim HttpReq
Dim Diamond
Set HttpReq = Server.CreateObject("Msxml2.ServerXMLHTTP.6.0")
HttpReq.open "GET", "http://url.com?id=" & Request.QueryString("id"), False
HttpReq.send

res = HttpReq.responseText
Set res = JSON.parse(res)
%>

It works.

Let’s say the JSON result will look like this:

res = {
    gallery: { 
        image1: { img: 'source url', thumb: 'source url' },
        image2: { img: 'source url', thumb: 'source url' },
        image3: { img: 'source url', thumb: 'source url' }
    },
    another_param1: 'foo',
    another param2: 'bar',
    ...
}

I want to then iterate the gallery object, not in JScript, but in VBScript.

How can I do that?

Thank you very much in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T20:36:42+00:00Added an answer on June 4, 2026 at 8:36 pm

    If it is really necessary to enumerate an object’s properties in VBScript then you will need to convert the object to a dictionary. Here is a simple function that will take a JScript object and return Scripting.Dictionary:

    <script runat="server" language="javascript">
    
        function JScriptObjectToDictionary(o)
        {
            var dict = new ActiveXObject("Scripting.Dictionary")
    
            for (var prop in o)
            {
                if (o.hasOwnProperty(prop))
                {
                    dict.add(prop, o[prop]);
                }
            }
    
            return dict;
        }
    </script>
    

    With this function present in your page you can now convert the gallery property to a dictionary:

     res.gallery = JScriptObjectToDictionary(res.gallery)
    

    You can then iterate as:

     For Each key in res.gallery
         Response.Write key & ": " & res.gallery(key).img & "<br />"
     Next
    

    Having said that its worth pointing out that properties named as a series like image1, image2 are a poor choice. It would be better if the JSON defined gallery as a simple array rather than an object. If you are in a position to influence the JSON design you should require that it be changed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am getting the JSON response like this : [ {IndexID:1,IndexName:Consumer Confidence Index(CCI),IndexValue:34.79,Month:10,PercentageChanged:0,Position:0,Year:2011}, {IndexID:1,IndexName:Consumer
I am getting JSON response from the server..Inside that JSON string i am having
I am getting JSON string from website. I have data which looks like this
I'm getting this json string info from the server : {members:[[sd2840d,Johny],[jkld341,Marry]]} So I store
<asp:Content ID=Content2 ContentPlaceHolderID=MainContent runat=server> <script type=text/javascript> GOTO = function () { alert(yes); $.ajax({ cache:
I have a strange problem with my script. I am getting a JSON result
Getting Json from the Server and displaying it in the grid is relatively straight
I'm getting JSON back in this format from my C# webmethod: {d:[ADAMS CITY,BOULDER,ANTON,ARBOLES]} I
I am using jquery mobile and phonegap. Here is my json result set getting
i am getting json data from this link now i want data from html_instructions:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.