Jump to content
Sign in to follow this  
Coniah

Help parsing boolean from RESTAdapter

Recommended Posts

I just finally got upgraded from Delphi 10.3.3 to 10.4.1. In recompiling one of my applications, I am getting "EVariantTypeCastError' 'Could not convert variant of type (UnicodeString) into type (Boolean)'. Upon closer inspection, the field value returned in the TClientDataSet is a widestring 'T', instead of a boolean 'True'. Compiling with 10.3.3 returns 'True' while 10.4.1 returns 'T' which is not in the default expected values for TrueBoolStrs. While I can work around this by either modifying TrueBoolStrs or comparing the returned value against 'T', I'd prefer to understand what changed when I went from 10.3.3 to 10.4.1.

 

I noticed that the TRESTResponseDataSetAdapter has a new property 'TypesMode' which defaults to 'StringOnly'. What is this property?

 

Thanks

Coniah

Share this post


Link to post
On 2/4/2021 at 10:33 AM, Coniah said:

I noticed that the TRESTResponseDataSetAdapter has a new property 'TypesMode' which defaults to 'StringOnly'. What is this property?

    /// <summary>
    /// Specifies the field type definition mode. When it is:
    /// * TJSONTypesMode.Rich, then adapter will try to derive field type from the JSON content.
    /// * TJSONTypesMode.JSONOnly, then adapter will use only JSON value types.
    /// * TJSONTypesMode.StringOnly, then all fields will be represented by ftWideString.
    /// Default value is TJSONTypesMode.Rich.
    /// </summary>

 

 

Share this post


Link to post

Thanks. I modified the TrueBoolStrs to include 'T' as a work around, but would prefer to have the parser return 'True' instead of 'T'. Any ideas on what caused the change from 10.3.3 to 10.4.1? Is it a configuration issue?

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×