Marshal recursive types in go
go, marshalling, unmarshalling
Solution
Your problem is not with recursion, it's understand encapsulation with Golang, e.i. public and private members. In order to encode in Go, your struct has to have public fields (starting with Uppercase):
type Dog struct {
Age int
Sibling *Dog
}
Full example: https://play.golang.org/p/eNdLaTfKtN
Problem
I want to Marshal and Unmarshal a recursive type in go something like this: ``` type Dog struct { age int sibling *Dog } ``` Is there any way to do this in golang? I tried with json.Marshal but it doesn't work.