package utils

import (
	"encoding/json"
)

// 去掉struct的空字段
func Struct2Slimming(input interface{}) (interface{}, error) {
	bs, err := json.Marshal(input)
	if err != nil {
		return nil, err
	}

	var output interface{}
	if err = json.Unmarshal(bs, &output); err != nil {
		return nil, err
	}

	return output, nil
}
