move json decoding from Api class to Client class