Sub test()
'创建json
Dim j As JsonBag
Set j = New JsonBag
j.IsArray = True '设置根对象为数组 []
j.Item = "Arr1"
With j.AddNewObject()
.Item("x") = 1
.Item("y") = 2
With .AddNewArray("Array")
.Item = 11
.Item = 22
End With
End With
Debug.Print j.JSON '输出JSON
'解析JSON
Dim j2 As JsonBag
Set j2 = New JsonBag
j2.JSON = j.JSON '解析json字符串,存储到j2对象
Debug.Print j2(2)("x") '读取值
j2(1) = "ArrVal1" '修改值
Debug.Print j2.JSON
End Sub下载链接:跳转下载
上一页:没有更多了!
下一页:没有更多了!
Copyright © 2025- vba.vip All Rights Reserved.