get rid of trailing \0 in uri
handle basic case of unparseable response
also trigger error when server sends non-dict JSON
Merge branch 'catch-json'