Q:

How can I create a nested json structure including a []byte type?

I'm currently trying to create the following nested json including a list of json and DER encoded byte array () of a certificate using golang: 
{
"webhooks":
    [{
    "clientConfig":{
         "caBundle":"<derData []bytes>"
    },
    "name":"sth_name"
    }]
}

Because of <certDerBytes[]>, I need to use a struct, but I don't know how to initialize it. 
I've created the struct so far:
type jsonstruct struct {
    Webhooks []struct {
        ClientConfig struct {
            CaBundle string `json:"caBundle"`
        } `json:"clientConfig"`
        Name string `json:"name"`
    } `json:"webhooks"`
}

But cannot instantiate the struct which I have to marshal into json.
I've tried using string literals, many ways of initializing it as you would for a normal non-nested struct. 
I've also dividing up the structs i.e. type jsonstruct.. type webhooks ..., etc, but that errored. 
I've also  initialized the struct from the inside out, but didn't work either. 
I need to create the

A:

You're best off probably using base64 on the byte array itself, and include that as the payload of the struct field.
One piece of nit, I personally do not like nested named-structs. Breaking them out lets you have much more flexibility in your code. 
For example:
type jsonstruct struct {
    Webhooks []Webhook `json:"webhooks"`
}

type Webhook struct {
    ClientConfig ClientConfig `json:"clientConfig"`
    Name string `json:"name"`
}

type ClientConfig struct {
    CaBundle string `json:"caBundle"`
}

func (cc ClientConfig) ToBytes() []byte {
    return []byte(base64.StdEncoding.DecodeString(cc.CaBundle))
}

func (cc ClientConfig) FromBytes(cert []byte) {
    cc.CaBundle = base64.StdEncoding.EncodeToString(cert)
}

