Created
November 13, 2020 05:56
-
-
Save mrcampbell/8f33d96951ee757a7f8123355aeaf704 to your computer and use it in GitHub Desktop.
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
// Decode the request | |
type TargetObject struct { | |
ID string `json:"id"` | |
} | |
// binaryOfOurSourcePayload = []byte(`{"id": "ABC123"}`) | |
var targetObject TargetObject | |
err = json.Unmarshal(binaryOfOurSourcePayload, &targetObject) | |
if err != nil { | |
// handle error | |
} | |
// now the value of TargetObject is TargetObject{ID: "ABC123"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment