New version 2.1, should be compatibile with most programs written against 2.0 and remains largely compatible with those written against earlier versions.
I should probably note that the whitespace-related properties are really only useful for producing formatted "dumps" of JSON for easier development, testing, debugging, and documenting. Parsing always ignores whitespace and adding whitespace just creates larger JSON payloads so production programs shouldn't do it.
Changes for 2.1
Even though just a "point release" this version makes quite a large number of changes. However it should be highly compatible with version 2.0 and most programs should not require changes to accomodate these JsonBag changes:
Minor optimization of Public Property Get Item (Exists() calls now create the "prefixed" keys used internally).
Other small optimizations.
New Clone() method returns a deep-copy of the original JsonBag.
New CloneItem read/write Property, like Item but deep-copies instead of returning/storing the original Object reference.
New ItemIsJSON read-only Property, used to determine whether an item is a JsonBag rather than a simple value.
New ItemJSON read/write Property, like Item but accepts and returns JSON text for JsonBag nodes.
Property Let Item/CloneItem will only allow VB6 Objects of type JsonBag to be assigned (i.e. this is now validated).
Bug fix: Parsing (Property Let JSON) did not detect "arrays" and "objects" with missing values between commas.
Bug fix: Replacing an "array" item at the end of the "array" caused "Subscript out of range" error 9.
Bug fix: Property Let JSON did not propagate .WhitespaceNewLine to child nodes as they were inserted.
Bug fix: Methods AddNewArray() and AddNewObject() did not propagate .DecimalMode, .Whitespace, .WhitespaceIndent, or .WhitespaceNewLine to child nodes as they were inserted.
Bug fix: Clear method did not reset .IsArray. Now it gets cleared to the default value False. This change might be the most likely one to have impact on existing programs relying on earlier behavior.
New conditional compilation constant: NO_DEEPCOPY_WHITESPACE. When True the .WhitespaceXXX properties are not propagated, which improves parsing performance.
Notes:
The whitespace propagation bug fixes resulted in a significant drop in parsing performance. However getting things right is probably more important. Massive JSON strings are not used very often, nor is heavy batch processing of vast numbers of smaller JSON strings. But as mentioned above in the changes list, NO_DEEPCOPY_WHITESPACE has been provided where the tradeoff in functionality for better performance makes sense.
Setting the VB6 compiler's native code optimization switches has little impact on JsonBag's parsing performance.
General:
Bug reports are always appreciated.
The new "cloning" operations would probably only be used in programs performing complex operations on JsonBags. That would be those needing to trim out parts of the tree as separate JsonBag writeable objects, copy nodes from one JsonBag to another, etc. Without cloning, making a change to such JsonBag nodes alters the single instance that multiple JsonBags would point to by Object references.
The ItemJson property is more of a convenience feature. It makes it easy to build a JsonJag partially from JSON fragements for the "constant" parts of a JSON payload being created. This could simplify client code by saving on calls to individual properties and methods just to insert such constant data. Previously a program might do quite a few calls or instead might create temporary JsonBags and assign JSON text to them via their JSON properties before adding them to the "main" JsonBag.
The attachment is bulky because of the Excel workbook included, which is just a tiny VBA usage demo.