i am not sure.. maybe you can make a custom serial...
# serialization
n
i am not sure.. maybe you can make a custom serializer and get the JsonObject, get the field type and then delegate to a specific serializer, but this is just spitballing and i have never tried this with js