parse json on the response and clean up the client (bug 868028)