extra: improve the errors for the JSON Decoder.

Fixes #4244.