Created
December 31, 2019 06:23
-
-
Save akaDPR/7103a4b9f3828944e0d75a9472821c10 to your computer and use it in GitHub Desktop.
Unmarshal JSON without defining struct In golang
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
package main | |
import ( | |
"fmt" | |
"encoding/json" | |
) | |
func main() { | |
samjson := `{"name":"mytheen"}` | |
var result map[string]interface{} | |
json.Unmarshal([]byte(samjson) , &result) | |
fmt.Println(result["name"]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment