Skip to content
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

Slice or Map not decoded #249

Open
DasJott opened this issue May 18, 2021 · 2 comments
Open

Slice or Map not decoded #249

DasJott opened this issue May 18, 2021 · 2 comments

Comments

@DasJott
Copy link

DasJott commented May 18, 2021

If a field is a slice of structs they are not decoded, instead it stays a slice of that type.
Same goes for maps.

See example here.

@mitchellh
Copy link
Owner

Hm yes, this is intended and I think would be a breaking change to change the default. By decoding to a map[string]interface{} you are saying that the value interface{} is anything that can be assigned to it. mapstructure realizes that it can decode directly onto there, which I think is arguably correct.

I'd be open to an enhancement that introduces a new option to "prefer maps" basically in this scenario.

@dangra
Copy link

dangra commented Feb 12, 2023

#314 looks like a perfect fix for this and much wanted :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants