func ConfigUnmarshalJSON(b []byte, c *Config) error {
	var keys map[string]json.RawMessage
	err := json.Unmarshal(b, &keys)
	if err != nil {
		return err
	}
	for key, value := range keys {
		if key == currentContextKeyJSON {
			if err := json.Unmarshal(value, &c.CurrentContext); err != nil {
				return fmt.Errorf("json: current context unmarshal: [%v]", err)
			}
			continue
		}
		if key == contextsKeyJSON {
			if c.Contexts == nil {
				c.Contexts = make(map[string]*ClientConfig)
			}
			bb, err := value.MarshalJSON()
			if err != nil {
				return fmt.Errorf("json: context unmarshal: [%v]", err)
			}
			if len(bb) == 0 {
				return fmt.Errorf("json: contexts can not be empty")
			}
			var contextsJSON map[string]json.RawMessage
			if err := json.Unmarshal(bb, &contextsJSON); err != nil {
				return err
			}
			for k, v := range contextsJSON {
				var clientConfig ClientConfig
				if err := ClientConfigUnmarshalJSON(v, &clientConfig); err != nil {
					return err  
				}
				c.Contexts[k] = &clientConfig
			}
		}
	}
	return nil
}
ConfigUnmarshalJSON parses the JSON-encoded `Config` and stores the result
in the `Config` pointed to by "c".
package api
import (
	"bytes"
	"encoding/json"
	"fmt"
)
var commaSep = []byte(",")
func ConfigMarshalJSON(c Config) ([]byte, error) {
	if len(c.Contexts) == 0 {
		return nil, fmt.Errorf("json write: contexts can not be empty")
	}
	if c.CurrentContext == "" {
		c.CurrentContext = DefaultContextKey
	}
	result := new(bytes.Buffer)
	result.WriteString(fmt.Sprintf(`{"%s":"%s",`, currentContextKeyJSON, c.CurrentContext))
	result.WriteString(fmt.Sprintf(`"%s":{`, contextsKeyJSON))
	n := 0
	for contextKey, v := range c.Contexts {
		n++
		b, err := ClientConfigMarshalJSON(*v)
		if err != nil {
			return nil, fmt.Errorf("json write: error writing the context [%s]: [%v]", contextKey, err)
		}
		result.WriteString(fmt.Sprintf(`"%s":`, contextKey))
		result.Write(b)
		if n < len(c.Contexts) {
			result.Write(commaSep)
		}
	}
	result.WriteString("}")  
	result.WriteString("}")  
	return result.Bytes(), nil
}