if (typeof msg !== 'object') { // uh-oh, did they pass us just a JSON string?
    try {
      msg = JSON.parse(msg); // maybe we can fix it for them…
    } catch (e) {
      throw new Error("Couldn't parse JSON string provided. Please pass a proper JSON object instead. \n\t" + e);