Fixed buffer overflow in JSON.

Reported on Coverity as CID 43614.