Reputation: 416
How to create JSON object in .vbs file?
I have tried this:
set json = CreateObject("Scripting.Dictionary")
But this object is not supporting json.AddStringAt
property. How to create JSON object that supports the json.AddStringAt
?
My sample file is
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
Set outFile = fso.CreateTextFile("output.json", True)
set json = CreateObject("Scripting.Dictionary")
index = -1
success = json.AddStringAt(-1,"Title","Pan's Labyrinth")
success = json.AddStringAt(-1,"Director","Guillermo del Toro")
success = json.AddStringAt(-1,"Original_Title","El laberinto del fauno")
success = json.AddIntAt(-1,"Year_Released",2006)
json.EmitCompact = 0
outFile.WriteLine(json.Emit())
outFile.Close
Upvotes: 0
Views: 11730
Reputation: 1
For 32 bit
set json = CreateObject("Chilkat_9_5_0.JsonObject")
For 64bit
set json = CreateObject64("Chilkat_9_5_0.JsonObject")
Upvotes: 0
Reputation: 424
It looks like there is a library that has the method that you are looking for.
set json = CreateObject("Chilkat_9_5_0.JsonObject")
https://www.chilkatsoft.com/refdoc/xChilkatJsonObjectRef.html
Upvotes: 2