code: function makeJSONBodyParser(spec) {
    const opts = spec.validate.jsonOptions || {};
    if (typeof opts.limit === 'undefined') {
      opts.limit = spec.validate.maxBody;
    }
  
    return async function parseJSONPayload(ctx, next) {
      if (!ctx.request.is('json')) {
        return ctx.throw(400, 'expected json');
      }
      ctx.request.body = ctx.request.body || await parse.json(ctx, opts);
      await next();
    };
  }
docs: Creates JSON body parser middleware.
  
  @param {Object} spec
  @return {async function}
  @api private