bug fix for invalid json

this is a check in case invalid json comes back from the server
simplified test initialization

also added another test
new gem