From afbcd66be194f59d9a64682c770c0ebad63488c4 Mon Sep 17 00:00:00 2001 From: Paolo Rossi Date: Mon, 29 Aug 2022 11:21:50 +0200 Subject: [PATCH] Better using TJSONBool than TJSONTrue, TJSONFalse (thanks to bm-q) --- Source/Neon.Core.Persistence.JSON.pas | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Source/Neon.Core.Persistence.JSON.pas b/Source/Neon.Core.Persistence.JSON.pas index e573133..86b965c 100644 --- a/Source/Neon.Core.Persistence.JSON.pas +++ b/Source/Neon.Core.Persistence.JSON.pas @@ -1374,10 +1374,8 @@ function TNeonDeserializerJSON.ReadEnum(const AParam: TNeonDeserializerParam): T begin if AParam.RttiType.Handle = System.TypeInfo(Boolean) then begin - if AParam.JSONValue is TJSONTrue then - Result := True - else if AParam.JSONValue is TJSONFalse then - Result := False + if AParam.JSONValue is TJSONBool then + Result := (AParam.JSONValue as TJSONBool).AsBoolean else raise ENeonException.Create('Invalid JSON value. Boolean expected'); end