maxJsonSize(): invalid literals are corrected; loop invariants are moved outside the correspondent loops.