We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TNeonDeserializerJSON.ReadEnum should use TJSONBool instead of TJSONTrue and TJSONFalse.
type TClassWithBool = class private FBoolProp: Boolean; public property BoolProp: Boolean read FBoolProp write FBoolProp; end; procedure TestBool; var LJSON: TJSONObject; LReader: TNeonDeserializerJSON; LClass: TClassWithBool; begin LClass := nil; LReader := nil; LJSON := TJSONObject.Create; try LJSON.AddPair('BoolProp', True); LReader := TNeonDeserializerJSON.Create(TNeonConfiguration.Default); LClass := TClassWithBool.Create; LReader.JSONToObject(LClass, LJSON); ShowMessage(LReader.Errors.Text); // => Error converting member [BoolProp] of type [TClassWithBool]: Invalid JSON value. Boolean expected finally LJSON.Free; LClass.Free; LReader.Free; end; end;
Suggested changes
function TNeonDeserializerJSON.ReadEnum(const AParam: TNeonDeserializerParam): TValue; var LIndex, LOrdinal: Integer; LTypeData: PTypeData; begin if AParam.RttiType.Handle = System.TypeInfo(Boolean) then begin if AParam.JSONValue is TJSONBool then Result := (AParam.JSONValue as TJSONBool).AsBoolean else raise ENeonException.Create('Invalid JSON value. Boolean expected'); end [...]
The text was updated successfully, but these errors were encountered:
Thanks @bm-q
resolved in the last commit
Ciao, Paolo.
Sorry, something went wrong.
No branches or pull requests
TNeonDeserializerJSON.ReadEnum should use TJSONBool instead of TJSONTrue and TJSONFalse.
Suggested changes
The text was updated successfully, but these errors were encountered: