VBA- json

ericlch16

Active Member
Joined
Nov 2, 2007
Messages
316
Office Version
  1. 2016
  2. 2013
Platform
  1. Windows
Hello

i have a complicated json with a lot of nested collection of dictionaries. I did the inside one. but in the final step , i need to convert this FROM

dim myvarDictionary as Dictionary
dim myvarCollection as Collection

myvarDictionary=
{
<dictionary>
}

TO

myvarCollection=
{
"MyName" : [

{
<dictionary>
}
]
}


i tried

myvarCollection.Add "MyName" myvarDictionary


but it is not working. What i am doing wrong ?
 
The library has a ParseJson method to convert a JSON string into a VBA object.

VBA Code:
dim myvarDictionary as Dictionary
set myvarDictionary = ParseJson({Object})

dim myvarCollection as Collection
set myvarCollection = ParseJson([Collection])

This string represents an object containing a MyName property, which holds a collection of objects as its value:
{
"MyName" : [

{
<dictionary>
}
]
}
 
Upvote 0

Forum statistics

Threads
1,226,848
Messages
6,193,317
Members
453,790
Latest member
yassinosnoo1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top