Thank you for your reply swagfag,
I am using the code in my last post to access data in a JSON file and transfer it to an excel document.
my code is essentially this:
Code: Select all
FileRead, JSONdata, %WBdir%\URLdata.json
readJSON := JSON.Load(JSONdata) ; load new
Xl.ActiveSheet.Range("B" URLcell).Value := readJSON["audits","uses-webp-images","details","items"]
I know that I am correctly accessing the data up until the point where I hit an array of URLs. I just need the correct syntax to complete my code above to be something like this:
Xl.ActiveSheet.Range("B" URLcell).Value := readJSON["audits","uses-webp-images","details","items"[0],"url"]
Below is a snippet from the whole JSON code that I'm trying to access (the three URLs) - the tree view from the object downward to this point looks like this
object > audits > uses-webp-images
and I'm trying to get to here
object > audits > uses-webp-images > details > items > 0 > url
which would return
https://www.merckvaccines.com/INTERSHOP ... tImage.jpg
snippet of code i'm trying to access:
Code: Select all
"uses-webp-images": {
"id": "uses-webp-images",
"title": "Serve images in next-gen formats",
"description": "Image formats like JPEG 2000, JPEG XR, and WebP often provide better compression than PNG or JPEG, which means faster downloads and less data consumption. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/webp).",
"score": 0.58,
"scoreDisplayMode": "numeric",
"rawValue": 600,
"displayValue": [
"Potential savings of %d KB",
103
],
"warnings": [],
"details": {
"type": "opportunity",
"headings": [
{
"key": "url",
"valueType": "thumbnail",
"label": ""
},
{
"key": "url",
"valueType": "url",
"label": "URL"
},
{
"key": "totalBytes",
"valueType": "bytes",
"label": "Original"
},
{
"key": "wastedBytes",
"valueType": "bytes",
"label": "Potential Savings"
}
],
"items": [
{
"url": "https://www.merckvaccines.com/INTERSHOP/static/WFS/Merck-MerckVaccines-Site/-/Merck-MerckVaccines-merckvaccines-responsive/-/img/pneumovax/bannerpatentImage.jpg",
"fromProtocol": true,
"isCrossOrigin": false,
"totalBytes": 65675,
"wastedBytes": 52827
},
{
"url": "https://www.merckvaccines.com/INTERSHOP/static/WFS/Merck-MerckVaccines-Site/-/-/en_US/img/pneumovax/bannerLeftBgMobile.png",
"fromProtocol": true,
"isCrossOrigin": false,
"totalBytes": 45569,
"wastedBytes": 44539
},
{
"url": "https://www.merckvaccines.com/INTERSHOP/static/WFS/Merck-MerckVaccines-Site/-/-/en_US/img/merck_logo_mob.png",
"fromProtocol": true,
"isCrossOrigin": false,
"totalBytes": 14760,
"wastedBytes": 8414
}
],
"overallSavingsMs": 600,
"overallSavingsBytes": 105780
}
},
Here is a link to the complete JSON file code for reference:
https://docs.google.com/document/d/1o2T ... sp=sharing
THank you so much for your insight and help in advance. Swagfag, I couldn't figure out how to get what I need based on the info you provided, but still very appreciative!