Convert nodes to array.