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

Commit 35a4b15

Browse files
committed
Document behaviour of squash when decoding struct->map
1 parent 9ed2c4b commit 35a4b15

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

mapstructure.go

+11
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,17 @@
7272
// "name": "alice",
7373
// }
7474
//
75+
// When decoding from a struct to a map, the squash tag squashes the struct
76+
// fields into a single map. Using the example structs from above:
77+
//
78+
// Friend{Person: Person{Name: "alice"}}
79+
//
80+
// Will be decoded into a map:
81+
//
82+
// map[string]interface{}{
83+
// "name": "alice",
84+
// }
85+
//
7586
// DecoderConfig has a field that changes the behavior of mapstructure
7687
// to always squash embedded structs.
7788
//

0 commit comments

Comments
 (0)