You could perhaps use Character.isDigit() before you try to turn it into a number.

// Json