Encode command as JSON, to allow arguments to be passed to it