All Projects → uber-go → mapdecode

uber-go / mapdecode

Licence: MIT license
Implement YAML/JSON decoding in one place.

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects
shell
77523 projects

mapdecode GoDoc Build Status Coverage Status

mapdecode implements a generic interface{} decoder. It allows implementing custom YAML/JSON decoding logic only once. Instead of implementing the same UnmarshalYAML and UnmarshalJSON twice, you can implement Decode once, parse the YAML/JSON input into a map[string]interface{} and decode it using this package.

var data map[string]interface{}
if err := json.Decode(&data, input); err != nil {
    log.Fatal(err)
}

var result MyStruct
if err := mapdecode.Decode(&result, data); err != nil {
    log.Fatal(err)
}

This package relies heavily on mapstructure for much of its functionality.

Status

Stable: No breaking changes will be made before 2.0.


Released under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].