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
@kwdef struct Person
name::String
fingers::Int=2
end
StructTypes.excludes(::Type{Human}) = (:fingers,)
In the above example, JSON3.write(Person("John")) returns {"name":"John"} as expected. However when we deserialize, we get Cannot `convert` an object of type Nothing to an object of type Int. Instead of setting fingers to nothing, it should probably call a constructor without fingers so that it sets default value 2?
The text was updated successfully, but these errors were encountered:
In the above example,
JSON3.write(Person("John"))
returns{"name":"John"}
as expected. However when we deserialize, we getCannot `convert` an object of type Nothing to an object of type Int
. Instead of settingfingers
tonothing
, it should probably call a constructor withoutfingers
so that it sets default value2
?The text was updated successfully, but these errors were encountered: