Created
November 20, 2013 19:34
-
-
Save sheki/7569546 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type files map[string]map[string]string | |
| func (f *files) UnmarshalJSON(data []byte) error { | |
| fmt.Println("GOT : ", string(data)) | |
| *f = make(map[string]map[string]string) | |
| if err := json.Unmarshal(data, f); err == nil { | |
| return nil | |
| } | |
| m := make(map[string]string) | |
| if err := json.Unmarshal(data, &m); err != nil { | |
| return errors.New("Cannot parse to files struct " + err.Error()) | |
| } | |
| (*f)["cloud"] = m | |
| return nil | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment