-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Null values are improperly serialized #72
Comments
@sproctor Can you provide a test case for me to reproduce the issue? I will try to fix it. |
Something like: object ExampleSpec : ConfigSpec {
val foo by optional(Foo(null))
}
data class Foo(val bar: Bar?)
data class Bar(val baz: String) I didn't do a lot of digging to see if null values other than data classes cause the issue. The output from that is:
It should be:
Changing the config file manually fixes the issue until the next time it's saved. |
Sorry, this was way more complicated than necessary. object ExampleSpec : ConfigSpec {
val foo by optional<String?>(null)
} That will store the null with quotes instead of as a null literal. I just didn't notice the issue there because it deserializes to the string "null" instead of a null value, but doesn't cause a crash. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 30 days if no further activity occurs, but feel free to re-open a closed issue if needed. |
Data classes with null property values are serialized with those values as a string literal with a value of "null" instead a null literal. Jackson then attempts to de-serialize the string literal to the type of the property.
The text was updated successfully, but these errors were encountered: