Report json decoding errors with debug data, added unit tests