@Minh Pham I believe there isn't any way to get the type of a value in Logic Apps and on top of that - strings, arrays, and objects are all treated as collections.
One way I could think of is to use a method that works only on arrays like length to validate the type. If this expression succeeds, then it's an array otherwise an object (I assume here you don't have a string output from your xpath). You can configure run after in a parallel branch to continue processing as if the value is an object.