mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-25 13:40:31 +01:00
* Patch from Luiz Americo to return a variant with get
git-svn-id: trunk@21821 -
This commit is contained in:
parent
1b3b097f3a
commit
3d002a13c5
@ -396,6 +396,7 @@ Type
|
||||
Function IndexOfName(const AName: TJSONStringType; CaseInsensitive : Boolean = False): Integer;
|
||||
Function Find(Const AName : String) : TJSONData; overload;
|
||||
Function Find(Const AName : String; AType : TJSONType) : TJSONData; overload;
|
||||
Function Get(Const AName : String) : Variant;
|
||||
Function Get(Const AName : String; ADefault : TJSONFloat) : TJSONFloat;
|
||||
Function Get(Const AName : String; ADefault : Integer) : Integer;
|
||||
Function Get(Const AName : String; ADefault : Int64) : Int64;
|
||||
@ -2059,6 +2060,18 @@ begin
|
||||
Result:=Nil
|
||||
end;
|
||||
|
||||
function TJSONObject.Get(const AName: String): Variant;
|
||||
Var
|
||||
I : Integer;
|
||||
|
||||
begin
|
||||
I:=IndexOfName(AName);
|
||||
If (I<>-1) then
|
||||
Result:=Items[i].Value
|
||||
else
|
||||
Result:=Null;
|
||||
end;
|
||||
|
||||
function TJSONObject.Get(const AName: String; ADefault: TJSONFloat
|
||||
): TJSONFloat;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user