From 030b739e60c1dba4790b629dca5b8fb190718182 Mon Sep 17 00:00:00 2001 From: Mark Sagi-Kazar Date: Fri, 25 Jun 2021 14:49:58 +0200 Subject: [PATCH] docs: add section about decoding formats Signed-off-by: Mark Sagi-Kazar --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index f409b15..e3986f7 100644 --- a/README.md +++ b/README.md @@ -778,6 +778,15 @@ if err != nil { Viper uses [github.com/mitchellh/mapstructure](https://github.com/mitchellh/mapstructure) under the hood for unmarshaling values which uses `mapstructure` tags by default. +### Decoding custom formats + +A frequently requested feature for Viper is adding more value formats and decoders. +For example, parsing character (dot, comma, semicolon, etc) separated strings into slices. + +This is already available in Viper using mapstructure decode hooks. + +Read more about the details in [this blog post](https://sagikazarmark.hu/blog/decoding-custom-formats-with-viper/). + ### Marshalling to string You may need to marshal all the settings held in viper into a string rather than write them to a file.