* Patch from Luiz Americo to return a variant with get

git-svn-id: trunk@21821 -
This commit is contained in:
michael 2012-07-09 07:39:51 +00:00
parent 1b3b097f3a
commit 3d002a13c5

View File

@ -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;