func modifierFromJSON(b []byte) (*parse.Result, error) {
	msg := &modifierJSON{}
	if err := json.Unmarshal(b, msg); err != nil {
		return nil, err
	}
	c := &http.Cookie{
		Name:     msg.Name,
		Value:    msg.Value,
		Path:     msg.Path,
		Domain:   msg.Domain,
		Expires:  msg.Expires,
		Secure:   msg.Secure,
		HttpOnly: msg.HTTPOnly,
		MaxAge:   msg.MaxAge,
	}
	return parse.NewResult(NewModifier(c), msg.Scope)
}
modifierFromJSON takes a JSON message as a byte slice and returns a
CookieModifier and an error.

Example JSON Configuration message:
{
"name": "Martian-Cookie",
"value": "some value",
"path": "/some/path",
"domain": "example.com",
"expires": "2025-04-12T23:20:50.52Z", // RFC 3339
"secure": true,
"httpOnly": false,
"maxAge": 86400,
"scope": ["request", "result"]
}
package cookie
import (
	"encoding/json"
	"net/http"
	"time"
	"github.com/google/martian/v3"
	"github.com/google/martian/v3/log"
	"github.com/google/martian/v3/parse"
)
func init() {
	parse.Register("cookie.Modifier", modifierFromJSON)
}
type modifier struct {
	cookie *http.Cookie
}
type modifierJSON struct {
	Name     string               `json:"name"`
	Value    string               `json:"value"`
	Path     string               `json:"path"`
	Domain   string               `json:"domain"`
	Expires  time.Time            `json:"expires"`
	Secure   bool                 `json:"secure"`
	HTTPOnly bool                 `json:"httpOnly"`
	MaxAge   int                  `json:"maxAge"`
	Scope    []parse.ModifierType `json:"scope"`
}
func (m *modifier) ModifyRequest(req *http.Request) error {
	req.AddCookie(m.cookie)
	log.Debugf("cookie.ModifyRequest: %s: cookie: %s", req.URL, m.cookie)
	return nil
}
func (m *modifier) ModifyResponse(res *http.Response) error {
	res.Header.Add("Set-Cookie", m.cookie.String())
	log.Debugf("cookie.ModifyResponse: %s: cookie: %s", res.Request.URL, m.cookie)
	return nil
}
func NewModifier(cookie *http.Cookie) martian.RequestResponseModifier {
	return &modifier{
		cookie: cookie,
	}
}