  This Letter reports measurements of differential cross sections for the
production of two Z bosons in association with jets in proton-proton collisions
at $\sqrt{s} =$ 8 and 13 TeV. The analysis is based on data samples collected
at the LHC with the CMS detector, corresponding to integrated luminosities of
19.7 and 35.9 fb$^{-1}$ at 8 and 13 TeV, respectively. The measurements are
performed in the leptonic decay modes ZZ $\to\ell^+ \ell^- \ell'^+ \ell'^-$,
where $\ell,\ell' =$ e, $\mu$. The differential cross sections as a function of
the jet multiplicity, the transverse momentum $p_\mathrm{T}$, and
pseudorapidity of the $p_\mathrm{T}$-leading and subleading jets are presented.
In addition, the differential cross sections as a function of variables
sensitive to the vector boson scattering, such as the invariant mass of the two
$p_\mathrm{T}$-leading jets and their pseudorapidity separation, are reported.
The results are compared to theoretical predictions and found in good agreement
within the theoretical and experimental uncertainties.
