You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have serialized this class to a file which the result is
{
"uiScale":1.0,
"theme":"dark"
}
now some folk comes and change the json file content to this
{
"uiScale":2.0, //from 1.0 to 2.0 (accpetable)"theme":1//from "dark" to 1 (not acceptable and cause the whole serialization to fail because it must be string)
}
now when I try to deserialize my Settings class
it will throw an exception
Is there any way when a key can't be deserialized use a default value and make the deserialization success ?
I need this result
{
"uiScale":2.0,
"theme":"dark"//because previous (1) is invalid for string type use default value that defined in data class
}
this is a simple example it could be very nested
The text was updated successfully, but these errors were encountered:
Let's suppose I have this class
I have serialized this class to a file which the result is
now some folk comes and change the json file content to this
now when I try to deserialize my
Settings
classit will throw an exception
Is there any way when a key can't be deserialized use a default value and make the deserialization success ?
I need this result
this is a simple example it could be very nested
The text was updated successfully, but these errors were encountered: