In this case, you've lost the information when deserializing to JS, because its type system can't model the distinction. So that number is effectively an integer now.
So from the serialization perspective, it seems correct.
What seems to he happening is your database has a strict schema. So I'd simply implement coercing at that level.