使用 Json 解析器在 Inno 设置中解析 JSON

问题描述

在我的 Inno 安装项目中,我需要解析一个 JSON。我尝试创建一个 dll 并使用 dll 函数解析 JSON,但是两天后它给了我一个访问冲突错误我找不到这个访问冲突的原因所以我决定在 Inno Setup 中解析 JSON。 我想解析这个 JSON 并使用 JsonParser library 也是这里有两个类似的问题 但我无法得到它。

How to parse a JSON string in Inno Setup?

JSON arrays in inno setup

{
 "Header":"Install FileType","Files":  
 [
   {
    "Filename":"sql Server","FileType": 1,"CheckExists":true,},{
    "Filename":"Dot Net 3.5","FileType": 2,"CheckExists":false,}

 ]
}

我需要这个功能

type
 TJFile = record 
   FileName : string;
   FileType : Integer;
   CheckExists: Boolean;

GetFile(JSON: string; Index :Integer; var File: TJFile );

如何解析 Json 以获取带有索引的文件。感谢您的帮助和指导。

解决方法

我不知道 Pascal Script,所以我无法真正回答您的问题,但我注意到您的 JSON 示例无效:“true”(第 9 行)后不应有逗号,“false”后也不应有逗号"(第 14 行)。