VBA-tools / VBA-JSON

JSON conversion and parsing for VBA
MIT License
1.79k stars 573 forks source link

Problem with Json Parsing Github repo topics field #206

Open rustcat opened 3 years ago

rustcat commented 3 years ago

I've been a very happy user of JsonConverter for a while now - this is really useful. My usage is with Github REST API to get back information about repos, releases, tags, etc.

Today, I got tripped up trying to use it for Github repo TOPICS. I've set all the Accept headers, etc. correctly and am getting back the information in a variable called 'strResult'. However, I'm not getting the exact value of the topic itself.

Postman shows me the format as: { "names": [ "training", "testing", "github", "tortoisegit" ] } This seems not to be the standard format of {"values":[{"a":1,"b":2,"c": 3},...]} I don't know if that is the problem.

My VBA script starts off with:

Set topics_Json = JsonConverter.ParseJson(strResult)

When I try: For Each topic In topics_Json Msgbox topic("names") Next topic

This throws a mismatch error.

If I replace the second line with 'Msgbox topic', it simply returns the string "names" but not the value. I suspect this may have to do something with objects vs. array ({ vs [) but I'm no expert.

Thanks for any help!