Browse Source

FIX: JSON-Pack utility

Alexander Koblov 2 years ago
parent
commit
3dc144d2e2
1 changed files with 11 additions and 11 deletions
  1. 11 11
      tools/jsonpack/jsonpack.lpr

+ 11 - 11
tools/jsonpack/jsonpack.lpr

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