package main

import (
	"encoding/json"
	"log"
	"os"
)

// section: code
type User struct {
	ID       int    `json:"id"`
	Name     string `json:"name"`
	Phone    string `json:"phone,omitempty"`
	Password string `json:"-"`
}

func main() {
	u := User{
		ID:       1,
		Name:     "Rob Pike",
		Password: "goIsAwesome",
	}

	err := json.NewEncoder(os.Stdout).Encode(&u)
	if err != nil {
		log.Fatal(err)
	}
}

// section: code

/*
// section: output
{"id":1,"name":"Rob Pike"}
// section: output
*/
