Przeglądaj źródła

* Add joIgnoreDuplicates

git-svn-id: trunk@45840 -
michael 5 lat temu
rodzic
commit
3d333a1d17

+ 2 - 1
packages/fcl-json/src/jsonparser.pp

@@ -129,7 +129,8 @@ begin
   // Add to existing structural type
   // Add to existing structural type
   if (FStruct is TJSONObject) then
   if (FStruct is TJSONObject) then
     begin
     begin
-    TJSONObject(FStruct).Add(FKey,AValue);
+    if (Not (joIgnoreDuplicates in options)) or  (TJSONObject(FStruct).IndexOfName(FKey)=-1) then
+      TJSONObject(FStruct).Add(FKey,AValue);
     FKey:='';
     FKey:='';
     end
     end
   else if (FStruct is TJSONArray) then
   else if (FStruct is TJSONArray) then

+ 1 - 1
packages/fcl-json/src/jsonscanner.pp

@@ -51,7 +51,7 @@ type
 
 
   EScannerError = class(EParserError);
   EScannerError = class(EParserError);
 
 
-  TJSONOption = (joUTF8,joStrict,joComments,joIgnoreTrailingComma);
+  TJSONOption = (joUTF8,joStrict,joComments,joIgnoreTrailingComma,joIgnoreDuplicates);
   TJSONOptions = set of TJSONOption;
   TJSONOptions = set of TJSONOption;
 
 
 Const
 Const