Sample preparation: ZIF-8 thin films were deposited onto gold-coated silicon wafers as previously described . The film thickness was measured using ellipsometry (Woolllam iSE). The crystallinity of the deposited materials was verified using grazing-incidence X-ray diffraction (PANalytical Empyrean equipped with a Cu-tube and a PIXcel detector). Circular gold top electrodes (12 nm thick, 0.2-1 mm in diameter) were deposited using shadow masks on an Angstrom thermal evaporator at a deposition rate of 0.5 Å/s. The measurements were performed on MIM capacitors with a 180 nm thick ZIF-8 layer and 0.4 mm diameter circular top electrodes. Samples for QCM measurements were prepared by depositing 280 nm thick ZIF-8 films on Au-coated 5 MHz AT-cut QCM sensors (AWSensors) using the same ZIF-8 film growth procedure as for the capacitive sensors.