Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for UnmarshalJSON (0.21 sec)

  1. internal/config/bool-flag.go

    	}
    
    	return "off"
    }
    
    // MarshalJSON - converts BoolFlag into JSON data.
    func (bf BoolFlag) MarshalJSON() ([]byte, error) {
    	return json.Marshal(bf.String())
    }
    
    // UnmarshalJSON - parses given data into BoolFlag.
    func (bf *BoolFlag) UnmarshalJSON(data []byte) (err error) {
    	var s string
    	if err = json.Unmarshal(data, &s); err == nil {
    		b := BoolFlag(true)
    		if s == "" {
    			// Empty string is treated as valid.
    			*bf = b
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Thu Apr 07 15:10:40 GMT 2022
    - 2.3K bytes
    - Viewed (0)
Back to top