Go - Processing JSON object
JSON is a commonly used and powerful data-interchange format, and Go provides a built-in json package to handle it. Let’ see the following example:
package main import ( "encoding/json" "log" "fmt" ) type People struct { Name string age int Career string `json:"career"` Married bool `json:",omitempty"` } func main() { p := &People{ Name: "Nan", age: 34, Career: "Engineer", } data, err := json.Marshal(p) if err != nil { log.Fatalf("JSON marshaling failed: %s", err) } fmt.
[Read More]