Prevent irregular real numbers from being treated as valid JSON values.

Fixes PR 14628.