I have the following JSON:
{"key1": "value1", "key2": 2}
Unfortunately TLama's Inno JSON Config library doesn't work with JSON strings but only with json files.
I tried to use JSON string instead of path to json file, but it didn't work.
if JSONQueryInteger('{"Info":{"User":2}}', 'Info', 'User', 0, IntValue) then
MsgBox('User=' + IntToStr(IntValue), mbInformation, MB_OK);
I know I could save my JSON to a file and then parse it but it seems kind of messy.
How to parse a JSON string in Inno Setup?
You can use JsonParser library instead. It can parse JSON strings.
It's not as easy to use as
JSONConfig.dll
. But on the other hand, it's a native Pascal Script code. So, it not only saves you from a temporary.json
file, but also from a temporary.dll
.The code can be like:
Another option is to fork the Inno JSON Config library and add support for parsing strings.