package main
import "encoding/json"
import "log"
import "fmt"
type book struct {
ID int
title string
pubDate string
author string
genre string
publisher string
language string
}
func main(){
b := book{
ID: 1,
title: "Standard",
pubDate: "Standard",
author: "Second-rate",
genre: "Standard",
publisher: "Standard",
language: "Standard",
}
var jsonData []byte
jsonData, err := json.Marshal(b)
if err != nil {
log.Println(err)
}
fmt.Println(string(jsonData))
}
The output is {"ID":1} .. why?!!
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/44b561be-30eb-48cb-ae0c-5d56f09e1c2cn%40googlegroups.com.