如何在vbscript文件中创建json对象?

闪耀

如何在.vbs文件中创建JSON对象?

我已经试过了:

set json = CreateObject("Scripting.Dictionary")

但是此对象不支持json.AddStringAt属性。如何创建支持的JSON对象json.AddStringAt

我的样本文件是

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
杰夫·布洛克

看起来好像有一个具有您要查找的方法的库。

set json = CreateObject("Chilkat_9_5_0.JsonObject")

https://www.chilkatsoft.com/refdoc/xChilkatJsonObjectRef.html

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章