code: function extractJSONPath(doc, expr) {
    // typeof null is 'object' hence the explicit check here
    if (typeof doc !== 'object' || doc === null) {
      return '';
    }
  
    let results;
  
    try {
      results = jsonpath.query(doc, expr);
    } catch (queryErr) {
      debug(queryErr);
    }
  
    if (!results) {
      return '';
    }
  
    if (results.length > 1) {
      return results[randomInt(0, results.length - 1)];
    } else {
      return results[0];
    }
  }
docs: doc is a JSON object