migration code conversion to new xml2json structure

Converted code to use the new xml2json structure, which
preserves xml elements order.