issue #355 - add better exceptions when encountering invalid json

addresses issue #355