-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Unmarshal doesn't work for json keys with _
#498
Comments
Try using |
Actually works! Thanks! |
A quick not here about the use of
Doing the same with
For this to work there cannot be any spaces between the tag and the key name. For example:
I wish not to disclose the amount of time I spent on that haha |
You can also change the tag used in mapstructure:
|
This is already covered in the troubleshooting guide: https://github.com/spf13/viper/blob/master/TROUBLESHOOTING.md#unmarshaling-doesnt-work |
Some keys didn't unmarshal correctly, this was due to a lack of understanding of how mapstructure works. Leaving `yaml:...` is incorrect and should be replaced by `mapstructure:...` instead. It's a bit confusing, but fixes the configuration unmarshal'ing now. See - https://github.com/spf13/viper/blob/master/TROUBLESHOOTING.md#unmarshaling-doesnt-work - spf13/viper#498 (comment) - spf13/viper#498 (comment)
Hi, so it seems that
Unmarshal
won't work with JSON keys, that have underscores. Here's some code:Output:
The text was updated successfully, but these errors were encountered: