FIX: JSON-Pack utility

This commit is contained in:
Alexander Koblov 2023-07-11 23:03:27 +03:00
commit 3dc144d2e2

View file

@ -13,7 +13,7 @@ uses
var var
AFileName: String; AFileName: String;
AConfig: TJSONObject; AConfig: TJSONData;
AStream: TFileStream; AStream: TFileStream;
AOptions: TFormatOptions; AOptions: TFormatOptions;
begin begin
@ -39,20 +39,20 @@ begin
AStream:= TFileStream.Create(AFileName, fmOpenRead or fmShareDenyNone); AStream:= TFileStream.Create(AFileName, fmOpenRead or fmShareDenyNone);
try try
AConfig:= GetJSON(AStream, True) as TJSONObject; AConfig:= GetJSON(AStream, True);
try
with TStringList.Create do
try
Text:= AConfig.FormatJSON(AOptions);
SaveToFile(AFileName);
finally
Free;
end;
finally
AConfig.Free;
end;
finally finally
AStream.Free; AStream.Free;
end; end;
try
with TStringList.Create do
try
Text:= AConfig.FormatJSON(AOptions);
SaveToFile(AFileName);
finally
Free;
end;
finally
AConfig.Free;
end;
end. end.