Handle json responses

This makes it possible to handle JSON reponses when the response content-type header contains 'json'.  This gets a step closer to moving to JSON everywhere see #56 Note that the parsed JSON responses are not guaranteed to be the same shape as the parsed XML responses.

I also took the opportunity to tidy up and improve the tests for the reponseparser by splitting out the cleaner functionality.