Page 1 of 1

JSON support & download to variable function

Posted: 02 Nov 2017, 08:18
by SirRFI
When making an utility program with GUI for end-user, sometimes it's worth implementing possibility to save "settings" of the program (such as which checkboxes are selected). It's achievable by using the Ini functions, but the concept itself seems somewhat obsolete and limited to me.

It would be nice to see in-built JSON support as an alternative to ini. Except for saving settings or other variable/data structure, it can be also used to communicate between other programs/languages as some kind of interface or transporting medium (assuming I used proper terms).

As an example for the above, if function DownloadToVar was added (or built into the existing one, like without specifying FileName?), AHK could obtain array/object content directly from the web. Currently there is only downloading to file: UrlDownloadToFile in AHK 1.X and Download in AHK 2.0a, which seemingly doesn't wait for the file to be downloaded.



Following codes are just examples that might help in implementation.



Coco's JSON 2.0 (and Jxon) - JSON lib for AutoHotkey
I updated (fixed errors that showed up on run) JXON library to AHK v2.0-a081-cad307c
Suggested new names for the functions: JsonLoad and JsonSave
Spoiler


DownloadToVar
Something along lines of this. Shortened (but not error-proof; tested only on JSON file):
Spoiler