That’s for code validation. For validation of the serialized data, you might use an external tool to validate the JSON, such as
JSON Schema, which doesn’t depend strictly on the compatibility of the Kotlin code. JSON Schema is an open standard, so is a good choice to adopt for that validation that doesn’t really tie you to any particular language or implementation