Closed tbett closed 8 years ago
Thank you.
You are almost there.
All you need to do is to assign the returning value of the parse()
method to an object and it will give you a reference to a JSONarray
object.
set jsonArr = JSON.parse(yourJSONarrayString)
response.write jsonArr(0)("dimensions")("length") ' direct and easy access, valid for single operations
If you have to access many fields, a better (faster) way should be:
set obj = jsonArr(0)
set dimensions = obj("dimensions")
response.write dimensions("length")
Thank you! This is exactly the package that is needed to extend ASP Classic a couple more years!!! Again, thank you for taking the time to put this together and answering my questions so quickly.
You are welcome. I'm pleased to have made something useful.
Great project. What is the method for selecting a child element? For example - dimensions > length. JSON("dimensions")("length")?
Also, select by index value for json object array - JSON(0)("dimensions")("length")?
[ { "id": 2, "name": "An ice sculpture", "price": 12.50, "tags": ["cold", "ice"], "dimensions": { "length": 7.0, "width": 12.0, "height": 9.5 } } ]