From 8557c79347a6b536a80d86893bfcf82c0de7f169 Mon Sep 17 00:00:00 2001 From: Fernando Fernandes Date: Tue, 19 Dec 2023 09:45:58 -0300 Subject: [PATCH] Bug Delphi 10.2: E2362 Cannot access protected symbol TJSONObject.FindValue --- src/DataSet.Serialize.pas | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/DataSet.Serialize.pas b/src/DataSet.Serialize.pas index 3b4cb1a..241dc31 100644 --- a/src/DataSet.Serialize.pas +++ b/src/DataSet.Serialize.pas @@ -363,8 +363,13 @@ procedure TDataSetSerializeHelper.LoadFromJSON(const AJSONObject: TJSONObject; c {$IF DEFINED(FPC)} LJSON := AJSONObject.Find(ARootElement); {$ELSE} - LJSON := AJSONObject.FindValue(ARootElement); - {$ENDIF} + {$IF COMPILERVERSION <= 32} + if not AJSONObject.TryGetValue(ARootElement,LJSON) then + LJSON := nil; + {$ELSE} + LJSON := AJSONObject.FindValue(ARootElement); + {$IFEND} + {$ENDIF} if not Assigned(LJSON) then raise Exception.Create('Root element not found!'); if LJSON.InheritsFrom(TJSONArray) then