-
Notifications
You must be signed in to change notification settings - Fork 206
Closed
Description
Hi,
Properties of type appengine.GeoPoint are not marshaled into json. Could marshaling/unmarshaling of appengine.GeoPoint be added to the package ?
Meanwhile, if someone encounters the same issue, here is a workaround:
type GeoPointJson appengine.GeoPoint
func (g *GeoPointJson) UnmarshalJSON(b []byte) (err error) {
var jm map[string]float64
if err = json.Unmarshal(b, &jm); err == nil {
g.Lat = jm["lat"]
g.Lng = jm["lon"]
}
return
}
func (g *GeoPointJson) MarshalJSON() ([]byte, error) {
jm := make(map[string]float64)
jm["lat"] = g.Lat
jm["lon"] = g.Lng
return json.Marshal(jm)
}
struct MyEntity {
Location GeoPointJson `datastore:"location" json:"location"`
}
Edit: It actually works as expected. Will close this issue.
Metadata
Metadata
Assignees
Labels
No labels