I have the following json:
{
"columns":[
"b_summary",
"end_fy",
"id",
"isin",
"market",
"name",
"num_employees",
"sector",
"ticker"
],
"data":[
[
"Microsoft Corp is a technology company. ",
6,
59265,
"US5949181045",
1,
"MICROSOFT CORP",
166475,
101003,
"MSFT"
]
]
}
I've parsed the text using this:
Function parseJson(strJson)
dim html, window
Set html = wscript.CreateObject("htmlfile")
Set window = html.parentWindow
window.execScript "var json = " & strJson, "JScript"
Set parseJson = window.json
End Function
Dim JSON
Set JSON = ParseJson(jsonText)
wscript.echo JSON.columns.length & " columns"
wscript.echo JSON.data.length & " rows"
I can see:
9 columns
1 rows
but I can't see how to access any of the properties under those.
I've tried:
JSON.columns(1), JSON.columns("1"), JSON.columns("[1]"), JSON.columns(1).name, JSON.columns(1).value
which resulted in "Unknown Runtime Error"
And
JSON.columns.item(1), JSON.columns.items(1)
And
dim col
for each col in JSON.columns
which resulted in "Object doesn't support this property or method."
I loaded it with vbsEdit, and it can see the json items listed neatly in their Variable Watcher during runtime, but I don't know how I can access them from my script.
Any idea how to access those properties will be appreciated!