JSON support & download to variable function

Discuss the future of the AutoHotkey language
SirRFI
Posts: 404
Joined: 25 Nov 2015, 16:52

JSON support & download to variable function

02 Nov 2017, 08:18

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
Use

Code: Select all

[/c] forum tag to share your code.
Click on [b]✔[/b] ([b][i]Accept this answer[/i][/b]) on top-right part of the post if it has answered your question / solved your problem.

Return to “AutoHotkey Development”

Who is online

Users browsing this forum: No registered users and 60 guests