function downloadJSON(stringOrBlob, filename = 'output.json') {
  /** @type {Blob} */
  let jsonBlob;
  // check if it's a Blob.., instanceof is too strict e.g. Blob polyfills
  if (stringOrBlob.constructor.name === 'Blob') {
    jsonBlob = /** @type {Blob} */ (stringOrBlob);
  } else {
    jsonBlob = new Blob([stringOrBlob], { type: 'application/json' });
  }
  downloadBlob(jsonBlob, filename);
}
@param {string | Blob} stringOrBlob
@param {string} filename