A measurement of the $ZZ$ production in the $\ell^{-}\ell^{+}\ell^{\prime -}\ell^{\prime +}$ and $\ell^{-}\ell^{+}\nu\bar{\nu}$ channels $(\ell = e, \mu)$ in proton--proton collisions at $\sqrt{s} = 8$ TeV at the Large Hadron Collider at CERN, using data corresponding to an integrated luminosity of 20.3 fb$^{-1}$ collected by the ATLAS experiment in 2012 is presented. The fiducial cross sections for $ZZ\to\ell^{-}\ell^{+}\ell^{\prime -}\ell^{\prime +}$ and $ZZ\to \ell^{-}\ell^{+}\nu\bar{\nu}$ are measured in selected phase-space regions. The total cross section for $ZZ$ events produced with both $Z$ bosons in the mass range 66 to 116 GeV is measured from the combination of the two channels to be $7.3\pm0.4\textrm{(stat)}\pm0.3\textrm{(syst)}\pm0.2\textrm{(lumi)}$ pb, which is consistent with the Standard Model prediction of $6.6^{+0.7}_{-0.6}$ pb. The differential cross sections in bins of various kinematic variables are presented. The differential event yield as a function of the transverse momentum of the leading $Z$ boson is used to set limits on anomalous neutral triple gauge boson couplings in $ZZ$ production.