3000 explained code solutions for 75 technologies

golangMarshal example

package main
import "encoding/json"

type President struct {
  Name string
  Age int

func main() {
  p := President{Name: "Joe", Age: 99}
  res, _ := json.Marshal(p)
}ctrl + c
package main

default package declaration


lib to work with JSON

type President struct

defines struct with fields


struct name


converts given variable (President struct in our case) to JSON