async function _json(req, res) {
  const {queueName, queueHost, state} = req.params;
  const {Queues} = req.app.locals;
  const queue = await Queues.get(queueName, queueHost);
  if (!queue) return res.status(404).json({message: 'Queue not found'});

  if (!isValidState(state, queue))
    return res.status(400).json({message: `Invalid state requested: ${state}`});

  let jobs;
  if (queue.IS_BEE) {
    jobs = await queue.getJobs(state, {size: 1000});
    jobs = jobs.map((j) =>
      _.pick(j, 'id', 'progress', 'data', 'options', 'status')
    );
  } else {
    const words = state.split('-');
    const finalStateName = words.map((word) => _.capitalize(word)).join('');
    jobs = await queue[`get${finalStateName}`](0, 1000);
    jobs = jobs.map((j) => j && j.toJSON());
  }

  const filename = `${queueName}-${state}-dump.json`;

  res.setHeader('Content-disposition', `attachment; filename=${filename}`);
  res.setHeader('Content-type', 'application/json');
  res.write(JSON.stringify(jobs, null, 2), () => res.end());
}
Returns the queue jobs in the requested state as a json document.

@prop {Object} req express request object
@prop {Object} res express response object