func (d *Duration) UnmarshalJSON(data []byte) error {
	if len(data) < 2 {
		return fmt.Errorf("invalid Duration data")
	}
	parsed, err := time.ParseDuration(string(data[1 : len(data)-1]))
	if err != nil {
		return err
	}
	*d = Duration(parsed)
	return nil
}
UnmarshalJSON is the JSON unmarshaller for (time.)Duration.
package config
import (
	"fmt"
	"time"
)
type Duration time.Duration
func (d Duration) MarshalJSON() ([]byte, error) {
	return []byte("\"" + time.Duration(d).String() + "\""), nil
}