VBA-tools/VBA-JSON

Generating JSON

stewart-anderson opened this issue · 2 comments

hi,

I've loaded up the project and I can see editing of JSON is fine. I can edit items in an array too and that seems fine.

Is the module supposed to allow extending JSON arrays? There's nothing in the MD and the you tube example only seems to demonstrate working with parsed data.

I want to be able to add elements to an array of items. Starting position is an empty array for example and then reading rows in my sheet to construct the remainder of the data into a JSOn file, ultimately to write it out as .json

I seem to have achieved this with the collection method .add where I added a parsed object to the array of existing items. debug print and when I coped the data out it parsed as JSON. I'm concerned that this isn't a documented feature as its kinda big!

I just wanted to check before I attempt to use it that way that this would not run into issues at some stage.

Am I missing something truly obvious

Ta

Stu

No you are not missing anything. VBA-JSON maps a JSON Array to a VBA.Collection object and maps a JSON Object to a Scripting.Dictionary object. So you need to use the appropriate methods for those objects to make conceptual changes to the JSON being represented by VBA-JSON. You can view the documentation on Microsoft's website.

VBA.Collection
Scripting.Dictionary

See also, issue 195