Hello.
I am writing a Google AppEngine app in Go. It has a web service that goes
to the Datastore and spits out JSON.
Now. What I want is to have the entities represented in JSON to contain the
entity key value.
Here's some pseudo-code of what I'm doing.
----------------------------------------------------------------
type Hum struct {
UID string
}
hums := make([]Hum, 0, 10)
if _, err := q.GetAll(c, &hums); err != nil {
fmt.Printf("error")
}
b, err := json.Marshal(hums);
if err != nil {
fmt.Printf("error")
}
w.Write([]byte(r.FormValue("jsoncallback")))
w.Write([]byte("("))
w.Write(b)
w.Write([]byte(")"))
----------------------------------------------------------------
So if I want the entity Datastore Key ID for each Hum entity - that is
where I'm lost.
Guessing I may have to put a Key property in the Hum struct maybe?
Any suggestions appreciated.
--