OSDN Git Service

TJSONValueに対応
authoryamat0jp <yamat0jp@yahoo.co.jp>
Wed, 22 Sep 2021 12:47:06 +0000 (21:47 +0900)
committeryamat0jp <yamat0jp@yahoo.co.jp>
Wed, 22 Sep 2021 12:47:06 +0000 (21:47 +0900)
Unit1.dfm
Unit1.pas
json_checker.dproj
json_checker.res

index 9ab21af..aa748e7 100644 (file)
--- a/Unit1.dfm
+++ b/Unit1.dfm
@@ -78,6 +78,7 @@ object Form1: TForm1
     Height = 335
     Align = alRight
     Indent = 19
+    ReadOnly = True
     TabOrder = 2
   end
   object StatusBar1: TStatusBar
@@ -107,7 +108,7 @@ object Form1: TForm1
     Left = 200
     Top = 88
     Bitmap = {
-      494C010102000800280010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
+      494C0101020008002C0010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
       0000000000003600000028000000400000001000000001002000000000000010
       0000000000000000000000000000000000000000000000000000000000000000
       0000000000000000000000000000000000000000000000000000000000000000
index 33b52ea..9462bb3 100644 (file)
--- a/Unit1.pas
+++ b/Unit1.pas
@@ -43,6 +43,7 @@ type
   private
     { Private \90é\8c¾ }
     procedure loop(item: TTreeNode; JSON: TJSONObject);
+    procedure arrloop(item: TTreeNode; arr: TJSONArray);
   public
     { Public \90é\8c¾ }
   end;
@@ -56,19 +57,47 @@ implementation
 
 uses Clipbrd;
 
+procedure TForm1.arrloop(item: TTreeNode; arr: TJSONArray);
+var
+  s: string;
+  val: TJSONValue;
+  i: integer;
+begin
+  item := TreeView1.Items.AddChild(item, s);
+  for i := 0 to arr.count - 1 do
+  begin
+    s := '_' + arr.Items[i].ToString;
+    val := arr.Items[i];
+    if val is TJSONObject then
+      loop(item, val as TJSONObject)
+    else if val is TJSONArray then
+      arrloop(item, val as TJSONArray)
+    else
+      TreeView1.Items.AddChild(item, s);
+  end;
+end;
+
 procedure TForm1.loop(item: TTreeNode; JSON: TJSONObject);
 var
-  i: Integer;
+  i, j: integer;
   pair: TJSONPair;
   s: string;
+  val: TJSONValue;
 begin
   for i := 0 to JSON.count - 1 do
   begin
     pair := JSON.Pairs[i];
-    if pair.JsonValue is TJSONObject then
+    val := pair.JsonValue;
+    if val is TJSONObject then
     begin
       s := pair.JsonString.ToString + ':';
-      loop(TreeView1.Items.AddChild(item, s), pair.JsonValue as TJSONObject);
+      JSON := pair.JsonValue as TJSONObject;
+      loop(TreeView1.Items.AddChild(item, s), JSON);
+    end
+    else if val is TJSONArray then
+    begin
+      s := pair.JsonString.ToString;
+      arrloop(TreeView1.Items.AddChild(item, s), pair.JsonValue as TJSONArray);
     end
     else
     begin
@@ -80,7 +109,7 @@ end;
 
 procedure TForm1.ToolButton2Click(Sender: TObject);
 var
-  i: Integer;
+  i: integer;
   j: TJSONObject;
 begin
   TreeView1.Items.Clear;
index 8c46c80..0cbb561 100644 (file)
@@ -5,9 +5,9 @@
         <FrameworkType>VCL</FrameworkType>
         <MainSource>json_checker.dpr</MainSource>
         <Base>True</Base>
-        <Config Condition="'$(Config)'==''">Debug</Config>
-        <Platform Condition="'$(Platform)'==''">Win32</Platform>
-        <TargetedPlatforms>1</TargetedPlatforms>
+        <Config Condition="'$(Config)'==''">Release</Config>
+        <Platform Condition="'$(Platform)'==''">Win64</Platform>
+        <TargetedPlatforms>3</TargetedPlatforms>
         <AppType>Application</AppType>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
         <DCC_UsePackage>FireDACSqliteDriver;FireDACDSDriver;DBXSqliteDriver;FireDACPgDriver;fmx;IndySystem;frxe21;TeeDB;tethering;vclib;DBXInterBaseDriver;DataSnapClient;DataSnapServer;DataSnapCommon;frx21;DataSnapProviderClient;DBXSybaseASEDriver;DbxCommonDriver;vclimg;dbxcds;DatasnapConnectorsFreePascal;MetropolisUILiveTile;vcldb;vcldsnap;fmxFireDAC;DBXDb2Driver;DBXOracleDriver;CustomIPTransport;PowerPDF91a_Delphi10_3;vclribbon;dsnap;IndyIPServer;fmxase;vcl;IndyCore;DBXMSSQLDriver;IndyIPCommon;CloudService;FmxTeeUI;FireDACIBDriver;CodeSiteExpressPkg;DataSnapFireDAC;FireDACDBXDriver;soapserver;inetdbxpress;dsnapxml;FireDACInfxDriver;FireDACDb2Driver;adortl;FireDACASADriver;bindcompfmx;FireDACODBCDriver;RESTBackendComponents;emsclientfiredac;rtl;dbrtl;DbxClientDriver;FireDACCommon;bindcomp;inetdb;frxTee21;Tee;DBXOdbcDriver;frxDB21;vclFireDAC;xmlrtl;DataSnapNativeClient;svnui;ibxpress;ActiveX;IndyProtocols;DBXMySQLDriver;FireDACCommonDriver;bindengine;vclactnband;bindcompdbx;soaprtl;FMXTee;TeeUI;bindcompvcl;vclie;Original;FireDACADSDriver;vcltouch;emsclient;VCLRESTComponents;FireDACMSSQLDriver;FireDAC;VclSmp;DBXInformixDriver;Intraweb;DataSnapConnectors;DataSnapServerMidas;dsnapcon;DBXFirebirdDriver;inet;fmxobj;FireDACMySQLDriver;soapmidas;vclx;svn;DBXSybaseASADriver;FireDACOracleDriver;fmxdae;RESTComponents;FireDACMSAccDriver;dbexpress;DataSnapIndy10ServerTransport;IndyIPClient;$(DCC_UsePackage)</DCC_UsePackage>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Base_Win64)'!=''">
+        <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)</DCC_Namespace>
+        <VerInfo_Locale>1033</VerInfo_Locale>
+        <Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
+        <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
+        <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
         <DCC_UsePackage>FireDACSqliteDriver;FireDACDSDriver;DBXSqliteDriver;FireDACPgDriver;fmx;IndySystem;TeeDB;tethering;vclib;DBXInterBaseDriver;DataSnapClient;DataSnapServer;DataSnapCommon;DataSnapProviderClient;DBXSybaseASEDriver;DbxCommonDriver;vclimg;dbxcds;DatasnapConnectorsFreePascal;MetropolisUILiveTile;vcldb;vcldsnap;fmxFireDAC;DBXDb2Driver;DBXOracleDriver;CustomIPTransport;vclribbon;dsnap;IndyIPServer;fmxase;vcl;IndyCore;DBXMSSQLDriver;IndyIPCommon;CloudService;FmxTeeUI;FireDACIBDriver;DataSnapFireDAC;FireDACDBXDriver;soapserver;inetdbxpress;dsnapxml;FireDACInfxDriver;FireDACDb2Driver;adortl;FireDACASADriver;bindcompfmx;FireDACODBCDriver;RESTBackendComponents;emsclientfiredac;rtl;dbrtl;DbxClientDriver;FireDACCommon;bindcomp;inetdb;Tee;DBXOdbcDriver;vclFireDAC;xmlrtl;DataSnapNativeClient;ibxpress;IndyProtocols;DBXMySQLDriver;FireDACCommonDriver;bindengine;vclactnband;bindcompdbx;soaprtl;FMXTee;TeeUI;bindcompvcl;vclie;FireDACADSDriver;vcltouch;emsclient;VCLRESTComponents;FireDACMSSQLDriver;FireDAC;VclSmp;DBXInformixDriver;Intraweb;DataSnapConnectors;DataSnapServerMidas;dsnapcon;DBXFirebirdDriver;inet;fmxobj;FireDACMySQLDriver;soapmidas;vclx;DBXSybaseASADriver;FireDACOracleDriver;fmxdae;RESTComponents;FireDACMSAccDriver;dbexpress;DataSnapIndy10ServerTransport;IndyIPClient;$(DCC_UsePackage)</DCC_UsePackage>
     </PropertyGroup>
     <PropertyGroup Condition="'$(Cfg_1)'!=''">
             </Deployment>
             <Platforms>
                 <Platform value="Win32">True</Platform>
-                <Platform value="Win64">False</Platform>
+                <Platform value="Win64">True</Platform>
             </Platforms>
         </BorlandProject>
         <ProjectFileVersion>12</ProjectFileVersion>
index d6cf632..0f3facb 100644 (file)
Binary files a/json_checker.res and b/json_checker.res differ