You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Inno Setup解析JSON Boolean值报TJsonBool类型未知错误如何解决?

你遇到的Unknown type 'TJsonBool'报错,是因为你使用的TJsonBool属于未定义的自定义类型。你参考的Inno Setup JSON解析实现中,并未定义该类型,解析后存储的JSON布尔值直接对应Inno Setup Pascal脚本的原生Boolean类型。

修复方案

仅需将函数定义中Bool变量的类型从TJsonBool替换为原生Boolean即可,修改后的完整代码如下:

function FindJsonBoolean(
  Output: TJsonParserOutput; Parent: TJsonObject; Key: TJsonString;
  var Bool: Boolean): Boolean;
var
  JsonValue: TJsonValue;
begin
  Result :=
    FindJsonValue(Output, Parent, Key, JsonValue) and
    (JsonValue.Kind = JVKBoolean);
  if Result then
    begin    
      Bool := Output.Boolean[JsonValue.Index]; 
    end;
end;

修改后即可正常编译,调用时直接传入Boolean类型的变量接收结果即可。

内容的提问来源于stack exchange,提问作者Crtac

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.24 00:36:03