0

I'm using XMLRPC calls from java to python.

So my server in python has these remote method and use apache xmlrpc lib in java to make the calls.

So i always prefered to use Dictionary to return from the calls. Cause when i used dictionary, Object data type in java, was directly printing my valueset returned from python. Then i used Map to iterate.

Now i 've to return list in one of the methods. I couldn convert Object to List/ArrayList/HashMap.

need help... How to convert Python List in Java?

Sample Output:

{hello=1, list=[Ljava.lang.Object;@1ba9f7}

1 Answer 1

2

It looks like the conversion worked correctly - [Ljava.lang.Object;@1ba9f7 is the default way that a Java array (not List) of Objects is printed out. Not very helpful, but there you go...

You could convert it to a Java List using Arrays.asList(mylist). See the JavaDoc.

Or try printing out the items in the array using:

for (Object obj: myArray)
{ 
   System.out.println(obj);
}
Sign up to request clarification or add additional context in comments.

2 Comments

Object res_lst =client.execute("getme",params); List<Object> l=Arrays.asList(res_lst); System.out.println(l.get(0)); Still i get the same value.. [Ljava.lang.Object;@115e891
Object[] rl =(Object[]) client.execute("getme",p); for (Object obj: rl) { System.out.println(obj); }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.