OSDN Git Service

解決できないエラーがあります。何をやっても満足にできないです。
authoryamat0jp <yamat0jp@yahoo.co.jp>
Thu, 23 Sep 2021 06:54:29 +0000 (15:54 +0900)
committeryamat0jp <yamat0jp@yahoo.co.jp>
Thu, 23 Sep 2021 06:54:29 +0000 (15:54 +0900)
Unit1.pas
json_checker.dproj

index 0b28ce0..1ed57e8 100644 (file)
--- a/Unit1.pas
+++ b/Unit1.pas
@@ -88,14 +88,16 @@ begin
   item := TreeView1.Items.AddChild(item, '_array');
   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
+    begin
+      s := arr.Items[i].ToString;
       TreeView1.Items.AddChild(item, s);
+    end;
   end;
 end;
 
@@ -114,7 +116,14 @@ begin
   for i := 0 to JSON.count - 1 do
   begin
     pair := JSON.Pairs[i];
-    val := pair.JsonValue;
+    if pair = nil then
+    begin
+      TreeView1.Items.AddChild(item, 'error');
+      Showmessage('\93à\95\94\83G\83\89\81[\82É\82æ\82è\92\86\92f\82µ\82Ü\82µ\82½');
+      Exit;
+    end
+    else
+      val := pair.JsonValue;
     if val is TJSONObject then
     begin
       s := pair.JsonString.ToString + ':';
@@ -123,7 +132,7 @@ begin
     end
     else if val is TJSONArray then
     begin
-      s := pair.JsonString.ToString;
+      s := pair.JsonString.ToString + ':';
       arrloop(TreeView1.Items.AddChild(item, s), pair.JsonValue as TJSONArray);
     end
     else
index 0cbb561..5b02ad6 100644 (file)
@@ -5,7 +5,7 @@
         <FrameworkType>VCL</FrameworkType>
         <MainSource>json_checker.dpr</MainSource>
         <Base>True</Base>
-        <Config Condition="'$(Config)'==''">Release</Config>
+        <Config Condition="'$(Config)'==''">Debug</Config>
         <Platform Condition="'$(Platform)'==''">Win64</Platform>
         <TargetedPlatforms>3</TargetedPlatforms>
         <AppType>Application</AppType>