Browse Source

Update UJSONFunctions.pas

PascalCoinDev 2 years ago
parent
commit
394fd31b94
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/libraries/pascalcoin/UJSONFunctions.pas

+ 7 - 1
src/libraries/pascalcoin/UJSONFunctions.pas

@@ -189,7 +189,8 @@ Type
     Function AsCurrency(ParamName : String; DefValue : Currency) : Currency;
     Function SaveAsStream(ParamName : String; Stream : TStream) : Integer;
     Function LoadAsStream(ParamName : String; Stream : TStream) : Integer;
-    Function GetNameValue(index : Integer) : TPCJSONNameValue;
+    Function GetNameValue(index : Integer) : TPCJSONNameValue; overload;
+    Function GetNameValue(Name : String) : TPCJSONNameValue; overload;
     Function IsNull(ParamName : String) : Boolean;
     Procedure SetAs(Name : String; Value : TPCJSONData);
     Procedure Delete(index : Integer); override;
@@ -960,6 +961,11 @@ Begin
   end;
 end;
 
+function TPCJSONObject.GetNameValue(Name: String): TPCJSONNameValue;
+begin
+  Result := Items[GetIndexOrCreateName(Name)] as TPCJSONNameValue;
+end;
+
 function TPCJSONObject.GetNameValue(index: Integer): TPCJSONNameValue;
 begin
   Result := Items[index] as TPCJSONNameValue;