Created
March 14, 2022 18:05
-
-
Save reinaldoacdc/3868e681d523c038d5dfe2cdbc023ba9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unit JsonObjectHelper; | |
interface | |
uses DBXJSON, Character; | |
type TJsonObjectHelper = class helper for TJsonObject | |
public | |
//Helper to find a JSON pair based on the pair string part | |
function Get(const PairName: UnicodeString): TJSONPair; overload; | |
end; | |
implementation | |
function TJsonObjectHelper.Get(const PairName: UnicodeString): TJSONPair; | |
var | |
Candidate: TJSONPair; | |
I: Integer; | |
begin | |
for i := 0 to Size - 1 do | |
begin | |
Candidate := Get(i); | |
if (Candidate.JsonString.Value = PairName) then | |
Exit(Candidate); | |
end; | |
Result := nil; | |
end; | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment