// ValueIsZero will return true if the contained JSON is a zero value. If the
// contained JSON is invalid, ValueIsZero will return false and the resulting
// JSON parsing error.
ValueIsZero will return true if the contained JSON is a zero value. If the
contained JSON is invalid, ValueIsZero will return false and the resulting
JSON parsing error.
// ValueIsZero will return true if the contained JSON is a zero value . If the // contained JSON is invalid ValueIsZero will return false and the resulting // JSON parsing error .
func (j RawJSON) ValueIsZero() (bool, error) {
	if len(j) == 0 {
		return false, fmt.Errorf("types.RawJSON: invalid JSON, an empty string cannot be unmarshaled")
	}
	var k interface{}
	err := json.Unmarshal(j, &k)
	if err != nil {
		return false, err
	}
	v := reflect.ValueOf(k)
	switch v.Kind() {
	case reflect.Map, reflect.Slice, reflect.String:
		return v.Len() == 0, nil
	case reflect.Float64:
		return v.Float() == 0, nil
	case reflect.Bool:
		return v.Bool() == false, nil
	case reflect.Invalid:
		return true, nil
	default:
		return false, fmt.Errorf("types.RawJSON: unexpected kind returned by json.Unmarshal; %s", v.Kind())
	}
}
func ( j RawJSON ) ValueIsZero ( ) ( bool , error ) { if len ( j ) == 0 { return false , fmt . Errorf ( " " ) } var k interface { } err := json . Unmarshal ( j , & k ) if err != nil { return false , err } v := reflect . ValueOf ( k ) switch v . Kind ( ) { case reflect . Map , reflect . Slice , reflect . String : return v . Len ( ) == 0 , nil case reflect . Float64 : return v . Float ( ) == 0 , nil case reflect . Bool : return v . Bool ( ) == false , nil case reflect . Invalid : return true , nil default : return false , fmt . Errorf ( " " , v . Kind ( ) ) } }
ValueIsZero will return true if the contained JSON is a zero value.
ValueIsZero will return true if the contained JSON is a zero value .
// json objects, arrays, strings ... // ... numbers // ... booleans // ... and null