Link to home
Create AccountLog in
Avatar of Aleks
AleksFlag for United States of America

asked on

Pass SQL to JSON. Page is in classic ASP and using Jquery

I have a page (ASP classic) which has a recordset with data.

recordset name:  rs_contact
field1:  FName
field2: LName
field3: email

This is the first time I will be doing this so a good explanation would be very much appreciated.
I need to pass this data to a JSON format so that I can the post it to an URL (to be used by an API)

The page is in classic ASP. The data I need to pass is in the format below. This considering I only got one result in my recordset and the values returned are:

FirstNm = 'Aleks'
LastNm = 'Demo'
email = ''

Those values somehow need to be turned into this JSON
We have to consider there may be more than one result from the recordset, another set of values would be:



This is the JSON file example I have to create:

  "first_name": "Aleks",
  "last_name": "Demo",
  "email_addresses": [
      "email_address": ""

Open in new window

Once this is created I need to post the data to an URL that is also stored in a recordset.

The URL will require a token as parameter, so I need to pass 2 parameters, the first part is the URL and the second is the token.

something like: https://<%=url("value")%>?token?<%=token("value")%>



Open in new window

We can break this down in those two parts. One is taking the recordset info and converting it into JSON.  And the second part is posting this JSON to the URL.
Avatar of HainKurt
Flag of Canada image

Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Aleks


Excellent source!   I will look closely at the original code and replace with the JSON code you provided.
Thank you!
You are welcome.