-
-
Save mottaquikarim/1312d9726d754a75173e5e156bda08e8 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
package main | |
import ( | |
"encoding/json" | |
"strings" | |
) | |
func main() { | |
jsonData := `{ | |
"email":"abhirockzz@gmail.com", | |
"username":"abhirockzz", | |
"blogs":[ | |
{"name":"devto","url":"https://dev.to/abhirockzz/"}, | |
{"name":"medium","url":"https://medium.com/@abhishek1987/"} | |
]}THIS IS INTENTIONALLY MALFORMED NOW` | |
jsonDataReader := strings.NewReader(jsonData) | |
decoder := json.NewDecoder(jsonDataReader) | |
var profile map[string]interface{} | |
err := decoder.Decode(&profile) | |
if err != nil { | |
panic(err) | |
} | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment