ExcelVBAでJSONを扱うためのモジュール「VBA-JSON」

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

使い方のサンプル

連想配列 Dictionary と、可変配列 Collection を使って JSONオブジェクトにデータをセットする
 '---------------------------------
 ' リクエストパラメタ生成
 '---------------------------------
 Dim JsonObject As Object
 Set JsonObject = New Dictionary

 JsonObject.Add "id", 1

 JsonObject.Add "name", "John Smith"

 JsonObject.Add "friend_ids", New Collection
 JsonObject("friend_ids").Add 10
 JsonObject("friend_ids").Add 20
 JsonObject("friend_ids").Add 30

 JsonObject.Add "shipTo", New Dictionary
 JsonObject("shipTo").Add "name", "Appirits Inc."
 JsonObject("shipTo").Add "address", "5F Kyocera-Harajuku Bldg. 6-27-8, Jingumae, Shibuya-ku"
 JsonObject("shipTo").Add "city", "Tokyo"
 JsonObject("shipTo").Add "state", "Japan"
 JsonObject("shipTo").Add "zip", "150-0001"

 ' イミディエイトウィンドウで確認(デバック用)
 Debug.Print JsonConverter.ConvertToJson(JsonObject, Whitespace:=2)

Dictionary を使うには参照設定で「Microsoft Scripting Runtime」をONにする
f:id:shikaku:20190312140956p:plain