VBA-tools / VBA-JSON

JSON conversion and parsing for VBA
MIT License
1.74k stars 566 forks source link

Generating JSON #248

Open stewart-anderson opened 1 year ago

stewart-anderson commented 1 year ago

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

houghtonap commented 1 year ago

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

stewart-anderson commented 1 year ago

Thanks for confirming.

Just wanted to check :)

Sorry I took so long to respond, I just found this in my spam folder.

regards

Stewart

------ Original Message ------ From "Andrew Houghton" @.> To "VBA-tools/VBA-JSON" @.> Cc "stewart anderson" @.>; "Author" @.> Date 09/03/2023 23:35:44 Subject Re: [VBA-tools/VBA-JSON] Generating JSON (Issue #248)

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 https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/collection-object Scripting.Dictionary https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/dictionary-object

See also, issue 195 https://github.com/VBA-tools/VBA-JSON/issues/195#issuecomment-821757856

— Reply to this email directly, view it on GitHub https://github.com/VBA-tools/VBA-JSON/issues/248#issuecomment-1462991316, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFSA6WDZN5JKNY6GJEQ2OY3W3JSNBANCNFSM6AAAAAAVRBJMNY. You are receiving this because you authored the thread.Message ID: @.***>