func MergeLayersOnion(o *onion.Onion) map[string]interface{} {
	layersData := o.LayersData()
	return onion.NewMapLayer(layersData...).Load()
}
MergeLayersOnion is used to get all layers data merged into one
Latest added overwrite previous ones.
package onionwriter
import (
	"encoding/json"
	"io"
	"github.com/goraz/onion"
	"github.com/mitchellh/mapstructure"
)
func SerializeOnion(o *onion.Onion, w io.Writer) error {
	data := o.LayersData()
	mergedData := onion.NewMapLayer(data...)
	enc := json.NewEncoder(w)
	enc.SetIndent("", "  ")
	return enc.Encode(mergedData.Load())
}