Last active
July 10, 2021 13:54
-
-
Save noamt/a58cc6510d131b1a3cba0b0339086310 to your computer and use it in GitHub Desktop.
Partial unmarshal for Medium post "Using Go's json.RawMessage"
This file contains 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
contents := []byte(` | |
{ | |
"key": "value", | |
"key2": "value2", | |
} | |
`) | |
type Custom struct { | |
Key string | |
Key2 json.RawMessage | |
} | |
customStructure := &Custom{} | |
_ = json.Unmarshal(contents, customStructure) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment