Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Slice or Map not decoded #249

Open
Open

Description

@DasJott

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.

Activity

  1. mitchellh commented on Apr 20, 2022

    @mitchellh
    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.

  2. dangra commented on Feb 12, 2023

    @dangra

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

  3. jchunkins commented on Jun 19, 2024

    @jchunkins

    Given that this project is being officially forked to https://github.com/go-viper/mapstructure (see #349) I'd suggest that this issue (and associated PR) be opened against that project now.

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址