const filename … // ToJSON converts caddyfile to its JSON representation. func ToJSON(caddyfile []byte) ([]byte, error) { … } // constructLine transforms tokens into a JSON-encodable structure; // but only one line at a time, to be used at the top-level of // a server block only (where the first token on each line is a // directive) - not to be used at any other nesting level. func constructLine(d *Dispenser) []interface{ … } // constructBlock recursively processes tokens into a // JSON-encodable structure. To be used in a directive's // block. Goes to end of block. func constructBlock(d *Dispenser) [][]interface{ … } // FromJSON converts JSON-encoded jsonBytes to Caddyfile text func FromJSON(jsonBytes []byte) ([]byte, error) { … } // jsonToText recursively transforms a scope of JSON into plain // Caddyfile text. func jsonToText(scope interface{ … } type EncodedCaddyfile … type EncodedServerBlock …