New JSON feature: ValueAtPath

As per request I have now added a new feature to the cJSONDictionary: ValueAtPath

How to use ValueAtPath

For this example I'll be using the following JSON structure:

Parsing and fetching some values. Remember to update your cJSONDictionary.pkg to version 1.11.


Some updates

Update #1
Version 1.01 of the cDictionary class is now available. It's a subclass of Microsoft's Scripting.Dictionary and it's a big speed-up compared to my cHashTable class. Unfortunately there are some limitations to what can be stored in the dictionary. The cHashTable can store any VDF type, including structs and struct arrays. The cDictionary can't. Arrays of any other type than String[] or Variant[] will also generate an error if inserted.

Avaliable methods are Set Value, Get Value, KeyExists, DeleteKey and Keys.

Update #2
Version 1.14 of cJSONParser is also available. All reduntant Ascii(c) calls have been removed. The speed gain from this was almost non-measurable, but the code looks better.

Number of milliseconds to parse a string of size x Kb.

All of the above is available on the downloads page.


cJSONParser v1.13 avaliable

With some help from DAW forum user Focus I've now improved the cJSONParser class. The parsing speed is about 270% faster on average compared to v1.12.

Auto parsing Microsoft style dates are now disabled by default. The feature can be activated by setting pbAutoParseMicrosoftDates to true before calling the Parse method.

Please download the latest version of VDFWebToolkit from the Downloads section.


New JSON features


Due to the slight ambigousity of the cJSONDictionary I decided to add support for explicitly typed values. I've had some bad experiences with Handle and Integer collisions while serializing a cJSONDictionary to a JSON string. As a side effect this also improves the precision of the cJSONParser. Great stuff!

Download the latest VDF Web Toolkit from the downloads page.

New public method for cJSONDictionary.pkg

Procedure Set TypedValue String sKey _jsond_type type Variant vValue _jsond_type is one of the following

  • _jsond_null
  • _jsond_bool
  • _jsond_string
  • _jsond_number
  • _jsond_object
  • _jsond_array
  • _jsond_object_array

Code Example

JSON string resulted from code above


cSummaryTable – Like SQL GROUP BY and SUM


I've added a new class based on cHashTable called cSummaryTable. It enables you to effectively sum values for a set of keys. It also comes with the possibility to retrieve the keys sorted by the sum size. Because it's based on the cHashTable class it's capable to handle large amouts of data without slowing down as it keeps on growing. It's available for download on the downloads page.

Code Example


Some bugfixes


I've corrected three bugs. One regarding the ErrorSystem in the cJSONDictionary class, one regarding unintentional content de-allocation in the cJSONParser class and one regarding type casting issues in the Keys method of the cHashTable. Make sure to download the latest version of these classes.

Fixed versions

  • cJSONDictionary.pkg - v 1.02
  • cJSONParser.pkg - v 1.03
  • cHashTable.pkg - v 1.03