I need to parse it and log some of the returned fields. Despite all my research, I haven't found the right example to accomplish this. Any help would be greatly appreciated.
VB ScriptASP
Last Comment
Big Monty
8/22/2022 - Mon
Scott Fell
I have just used jquery for this and posted to an asp page.
I found http://www.aspjson.com/
Looking at the sample you just loop through and take what you need. If you have a lot of data to parse, it will go faster doing this client side. If it is just a small amount of data, this will work fine.
Set oJSON = New aspJSON'Load JSON stringoJSON.loadJSON(jsonstring)'Get single valueResponse.Write oJSON.data("firstName") & "<br>"'Loop through collectionFor Each phonenr In oJSON.data("phoneNumber") Set this = oJSON.data("phoneNumber").item(phonenr) Response.Write _ this.item("type") & ": " & _ this.item("number") & "<br>"Next'Update/Add valueoJSON.data("firstName") = "James"'Return the objectResponse.Write oJSON.JSONoutput()
I stumbled across that example several times and don't really understand it. As I recall, phoneNumber is an array, and the code doesn't reference other items on different levels. What I am most interested in (in my example) is date and status. I just haven't been successful in finding the correct way to reference the different levels of the tree.
Scott Fell
What needs to be done with the data? and how are you accessing it?
I think it would be faster and easier to use jquery on the client side and if you need to post anything to the db, we can use ajax. If you just need to display the data, that is even easier.
What I most need to do is test flag and.code under response.request.status. But ideally, I want to understand how to extract the field values in VBScript so I can access any field I need to.
I found http://www.aspjson.com/
Looking at the sample you just loop through and take what you need. If you have a lot of data to parse, it will go faster doing this client side. If it is just a small amount of data, this will work fine.
Open in new window
Which fields do you want?