add casting fix

Hi!

I add some lines of code to handle when the result of xmlrpc is in json format.

Best regards
Hainan