From 35a4b158b796ba409f3faeeabcb8405d67184456 Mon Sep 17 00:00:00 2001 From: Daniel Nephin Date: Tue, 22 Dec 2020 16:01:19 -0500 Subject: [PATCH] Document behaviour of squash when decoding struct->map --- mapstructure.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/mapstructure.go b/mapstructure.go index 5aee9bdb..6cb703cf 100644 --- a/mapstructure.go +++ b/mapstructure.go @@ -72,6 +72,17 @@ // "name": "alice", // } // +// When decoding from a struct to a map, the squash tag squashes the struct +// fields into a single map. Using the example structs from above: +// +// Friend{Person: Person{Name: "alice"}} +// +// Will be decoded into a map: +// +// map[string]interface{}{ +// "name": "alice", +// } +// // DecoderConfig has a field that changes the behavior of mapstructure // to always squash embedded structs. //