Logic error in var comparisons?

delaySync.value is a juce::Value
When it is set from our UI delaySync.value.getValue().equals(1) returns true
After that value is serialized and deserialized to XML using ValueTree delaySync.value.getValue().equals(1) returns false

Debugging into the var comparison stuff I got as far as a String comparison between “1.0” and “1” being the source of the false result.

The outcome is obviously unintuitve, can anyone explain the cause and whether it could be improved?

Thanks,
Dave