It seems json.Marshall doe not support anonymus structures. Please change the definition of your A structure to
type A struct {
Name string
MyP P
MyQ Q
}
and make sthe corresponding change where you refrence those structures
a.MyP = P{Age: 34}
a.MyQ = Q{Age: 35}