Handle JSON Object in XMLHttp response in Excel VBA Code

前端 未结 3 730
难免孤独
难免孤独 2020-12-01 09:31

I need to handle a JSON Object which is the response of XMLHTTPRequest in Excel VBA. I wrote the code below, but it doesn\'t work:

  Dim sc As Object
  Set s         


        
3条回答
  •  难免孤独
    2020-12-01 10:10

    I've had a lot of success with the following library:

    https://github.com/VBA-tools/VBA-JSON

    The library uses Scripting.Dictionary for Objects and Collection for Arrays and I haven't had any issues with parsing pretty complex json files.

    As for more info on parsing json yourself, check out this question for some background on issues surrounding the JScriptTypeInfo object returned from the sc.Eval call:

    Excel VBA: Parsed JSON Object Loop

    Finally, for some helpful classes for working with XMLHTTPRequest, a little plug for my project, VBA-Web:

    https://github.com/VBA-tools/VBA-Web

提交回复
热议问题