This code printed '{0, 0}'. How can you fix it?gotype Point struct { x int y int}func main() { data := []byte('{'x':1, 'y': 2}') var p Point if err := json.Unmarshal(data, &p); err != nil { fmt.Println('error: ', err) } else { fmt.Println(p) }}

🎲 Try a Random Question  |  Total Questions in Quiz: 42  |  🧠 Study this quiz with Flashcards
This question is part of a full practice quiz:
Go (Programming Language) Quiz — practice the complete quiz, review flashcards, or try a random question.

Go (Programming Language) MCQs For LinkedIn Skill Assessments.


This code printed '{0, 0}'. How can you fix it?<br>go<br>type Point struct {<br> x int<br> y int<br>}<br>func main() {<br> data := []byte('{'x':1, 'y': 2}')<br> var p Point<br> if err := json.Unmarshal(data, &p); err != nil {<br> fmt.Println('error: ', err)<br> } else {<br> fmt.Println(p)<br> }<br>}<br>