omegastripes / VBA-JSON-parser

Backus-Naur Form JSON Parser based on RegEx for VBA
GNU General Public License v3.0
107 stars 44 forks source link

Type mismatch #10

Closed yfrindel closed 4 years ago

yfrindel commented 4 years ago

Hi,

Please, could you tell me how I can access to the last element of my JSON string please ?

image

I tried with the following code, but the vJSON seems not correct :

image

Thx

omegastripes commented 4 years ago
historyItem = vJSON("measures")(0)
valueStr = historyItem(UBound(historyItem))("value")
yfrindel commented 4 years ago

Thank you for the answer, but I have still a problem : image

that's the value of the sJSONstring : "{"paging":{"pageIndex":1,"pageSize":100,"total":3},"measures":[{"metric":"coverage","history":[{"date":"2019-05-29T16:35:40+0100","value":"0.0"},{"date":"2019-05-30T07:48:40+0100","value":"0.0"},{"date":"2019-06-18T10:44:37+0100","value":"0.0"}]}]}"

omegastripes commented 4 years ago
historyItem = vJSON("measures")(0)("history")
valueStr = historyItem(UBound(historyItem))("value")
yfrindel commented 4 years ago

Excellent, it works. Thanks