Maybe a will add a short description of the heuristic in the comment, e.g. "If the tag element first child is text we assume that is a "leaf" node, otherwise we assume that it is vector or key-map object and apply xml2json recursiely" or something like that.