xml2json update for function

reference to pull request reference request #598 for original