From 7a036ca37d0d2097474bef4724f283dd1df417fa Mon Sep 17 00:00:00 2001 From: Vinicius Sanchez Date: Thu, 14 Dec 2023 14:35:16 -0300 Subject: [PATCH] Bug fix lazarus --- src/DataSet.Serialize.pas | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/DataSet.Serialize.pas b/src/DataSet.Serialize.pas index 112a1f5..b84892e 100644 --- a/src/DataSet.Serialize.pas +++ b/src/DataSet.Serialize.pas @@ -352,7 +352,7 @@ procedure TDataSetSerializeHelper.LoadFromJSON(const AJSONObject: TJSONObject; c procedure TDataSetSerializeHelper.LoadFromJSON(const AJSONObject: TJSONObject; const ARootElement: string = ''; const AOwns: Boolean = True); var - LJSON: TJSONValue; + LJSON: {$IF DEFINED(FPC)}TJSONData{$ELSE}TJSONValue{$ENDIF}; LJSONSerialize: TJSONSerialize; begin if ARootElement.Trim.IsEmpty then @@ -360,7 +360,11 @@ procedure TDataSetSerializeHelper.LoadFromJSON(const AJSONObject: TJSONObject; c else begin try + {$IF DEFINED(FPC)} + LJSON := AJSONObject.Find(ARootElement); + {$ELSE} LJSON := AJSONObject.FindValue(ARootElement); + {$ENDIF} if not Assigned(LJSON) then raise Exception.Create('Root element not found!'); if LJSON.InheritsFrom(TJSONArray) then @@ -431,4 +435,4 @@ procedure TDataSetSerializeHelper.MergeFromJSONObject(const AJSONString: string) MergeFromJSONObject({$IF DEFINED(FPC)}GetJSON(AJSONString){$ELSE}TJSONObject.ParseJSONValue(TEncoding.UTF8.GetBytes(AJSONString), 0){$ENDIF} as TJSONObject) end; -end. \ No newline at end of file +end.