package main
import (
“fmt”
“github.com/jinzhu/copier”
)
type User struct {
Name string json:"name"
Age int json:"age"
Location string json:"location"
}
func main() {
user1 := User{Name: “John Doe”, Age: 30, Location: “New York”}
user2 := User{}
// Copy fields with same JSON tag using copier package
copier.Copy(&user2, &user1)
fmt.Println(user2)
}