Created
July 18, 2019 21:25
-
-
Save krishbhanushali/16764cd16547df0835e90339a7a63881 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" | |
"fmt" | |
"os" | |
) | |
func main() { | |
type Employee struct { | |
EmployeeID int | |
EmployeeName string | |
EmployeeEmailAddress string | |
} | |
employees := []Employee{ | |
Employee{ | |
EmployeeID: 1, | |
EmployeeName: "XYZ", | |
EmployeeEmailAddress: "xyz@pqr.com", | |
}, | |
Employee{ | |
EmployeeID: 2, | |
EmployeeName: "ABC", | |
EmployeeEmailAddress: "abc@pqr.com", | |
}, | |
} | |
b, err := json.Marshal(employees) | |
if err != nil { | |
fmt.Println("error:", err) | |
} | |
os.Stdout.Write(b) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment