Also try to accomodate formats to explicitly exclude the decimal (e.g. %.0f).
The user might want to use the userdata for something different, so the serializer should ignore it by default. Explicitly setting the serializer to json_object_double_to_json_string will still make it interpret the userdata as a format string.