If you have { feature: null } and you're trying to unmarshal it into something like
type Struct struct {
Feature geojson.Feature `json:"feature"`
}
you'd get a panic. This fix sets Struct.Feature to an empty object. I think this is the correct behavior as you might have { isFeature: true, feature: null } and you're code would check isFeature first.
If you really care about if it's null vs. empty you should model your data as
type Struct struct {
Feature *geojson.Feature `json:"feature"`
}
fixes https://github.com/paulmach/orb/issues/144
If you have
{ feature: null }
and you're trying to unmarshal it into something likeyou'd get a panic. This fix sets
Struct.Feature
to an empty object. I think this is the correct behavior as you might have{ isFeature: true, feature: null }
and you're code would checkisFeature
first.If you really care about if it's null vs. empty you should model your data as
the check
Struct.Feature != nil