Using JavaScript functions to parse JSON, on top of ScriptControl, we can create a parser in VBA that will list each data point inside JSON. No matter how nested or complex the data structure is, as long as we provide a valid JSON, this analyzer will return a complete tree structure.
JavaScripts The Eval, getKeys, and getProperty methods provide building blocks for validating and reading JSON.
In combination with a recursive function in VBA, we can iterate over all keys (up to the nth level) in a JSON string. Then, using the Tree control (used in this article) or a dictionary, or even on a simple sheet, we can arrange the JSON data as needed.
You can see the full VBA code here
cyboashu Nov 12 '14 at 4:41 2014-11-12 04:41
source share