make encode-* functions write to *json-output* if bound