DotNet variable and Nullable Types

Hi, I’m consuming REST service into NAV so I created .NET wrapper to talk to the service.

In the objects in the wrapper I’m using nullable types for my properties (string? long? etc) because the REST service sometimes returns null and I’m deserializing the reply from the services into the objects.

The problem begins when reading the value of these properties in NAV as NAV does not see this as strings and decimals anymore but only as DotNet objects as I made the properties nullable.

One way I can read this is to save the value of the property into variant and then into the correct field/variable

StagingVariant := MyDotNet.Id;
IF StagingVariant.ISINTEGER THEN
MyTable.MyInt := StagingVariant;

This is not the most elegant solution and I was thinking if anyone knows any better way to do this?