Skip to content

Commit

Permalink
Better using TJSONBool than TJSONTrue, TJSONFalse (thanks to bm-q)
Browse files Browse the repository at this point in the history
  • Loading branch information
paolo-rossi committed Aug 29, 2022
1 parent f364aa6 commit afbcd66
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Source/Neon.Core.Persistence.JSON.pas
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit afbcd66

Please sign in to comment.