Hi,

I am sending a map of elements indexed by a bson.ObjecId(), coming from the 
bdd.


type Stats struct {
 A bson.ObjectId                 `json:"a,omitempty" bson:"a,omitempty"`
 B map[bson.ObjectId]CustomType   `json:"b,omitempty" bson:"b,omitempty"`
}


// t is of type Stats 
if err = c.WriteJSON(t); err != nil { // c is of type *Conn from mux 
websocket, and this is where magic happens
 fmt.Println("write:", err) // Nothing is triggered here
 break
}


The result is not as expected :


   "57ffdff9687a95381c5831d3" // this is A
   B:{,…} 
   W6�0�������}: // this is the index of the first element of B
   W6�3�������
   
      
The bson.ObjectId object A is healthy as expected, while the indexes of the 
elements of B are quite unreadable.
I have tried WriteJson and (Marshal + WriteMessage) - both WriteJson and 
WriteMessage are wrappers of the native methods, from gorilla/mux -

Do you know of anything special marshaling map[bson.ObjectId] ?

Thanks for your help,
   
   
   
   1. 
      

-- 
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 golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to