ohler55 / ojg

Optimized JSON for Go
MIT License
839 stars 50 forks source link

Private fields should be ignored when Unmarshaling #93

Closed right-mouse closed 2 years ago

right-mouse commented 2 years ago

When unmarshaling or recomposing to a struct, if a key matching a private field is found, the private field is attempted to be set resulting in a panic:

reflect: reflect.Value.Set using value obtained using unexported field

Playground demonstration: https://go.dev/play/p/r6oam713GJo

ohler55 commented 2 years ago

Please try the "respect-private" branch.

right-mouse commented 2 years ago

Looks to be working as expected on that branch.

ohler55 commented 2 years ago

Thanks

ohler55 commented 2 years ago

Released

right-mouse commented 2 years ago

Thanks for the quick fix.