Question: I have a Python XML-RPC server that has a function that returns a tuple, e.g: 

```
def function_name(first_parameter, second_parameter)
    #do something
    return (x,y)

```

I'm calling this function from Java in an Android application using [aXMLRPC](https://www.timroes.de/2013/06/13/axmlrpc-a-lightweight-xml-rpc-library-for-android/), the code is:

```
Object id = client.call("function_name", first_parameter, second_parameter);

```

How can I extract the two return values of the function from the Object id?

Answer: 
[The documentation](https://github.com/timroes/aXMLRPC) for the XML-RPC library you're using to talk to the Python service says that there are only a limited number of possible return types; I don't know for sure without trying it, but clearly your Tuple is going to come back either as an array or perhaps as a `Map<String, Object>`. You're going to have to experiment a little but it shouldn't be too bad. Try something like this:

```
Object id = client.call("function_name", first_parameter, second_parameter);
System.out.println(id.getClass().getName());

```

to find out what you're dealing with, and then once you know, you can write the real code accordingly. Most likely, `id` will turn out to be an `Object[2]` containing the two values.
What you want to achieve is unpacking values in the result `Object`. Which you can do writing a method that returns a `Object[]`:

```
public static Object[] unpack(Object array) 
{
    Object[] array2 = new Object[Array.getLength(array)];

    for(int i=0;i<array2.length;i++)
        array2[i] = Array.get(array, i);

    return array2;
}

```

[This thread seems relevant](https://stackoverflow.com/questions/8095016/unpacking-an-array-using-reflection).