Show helpful error message if JSON can't be parsed

The JSON module shows only the area of the error and then all the
following lines until the end of the file without a line number.

To make the error message for the user more helpful the needless parts
are cut and the line number is calculated.