AutoHotkey-JSON
AutoHotkey-JSON copied to clipboard
[suggestion] option to use other object factory e.g. Scripting.Dictionary wrapper
What a custom object factory can solve:
- case sensitivity. The default AHK object is not, but JSON specs is.
- preservation of order. The default AHK object auto-sorts alphabetically.
Implementing:
Add a static ObjectFactory
property to JSON class, defaulting to Object
. Every time Load creates a new object, it uses the ObjectFactory value. If it has a __Class
property it calls new ObjectFactory
, otherwise it just calls ObjectFactory()
.
To set their own object factories users simply set the property to a custom class that is object-like i.e. it implements key Object methods such as HasKey
and _NewEnum
that JSON class uses. One particular example is this Scripting.Dictionary
class wrapper: forum link
I have successfully implemented this in a keyvalue parser library I'm using. I haven't shipped anything that uses it yet... but soon...