소스 검색

FIX: JSON-Pack utility

Alexander Koblov 2 년 전
부모
커밋
3dc144d2e2
1개의 변경된 파일11개의 추가작업 그리고 11개의 파일을 삭제
  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.