Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1055397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:33:22+00:00 2026-05-16T17:33:22+00:00

I have an object in my code of the type Object: Object o The

  • 0

I have an object in my code of the type Object:
Object o

The class of the instance is Object: o.getClass() gives Object.

Now, it should be a Map! How can I upcast this to a Map?

I tried: Map<String, Object> map = (HashMap<String,Object>)o

But this returns:
java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to java.util.HashMap

The instance ‘o’ comes from a XMLRPC request. This request does not qualify variables correctly supposedly

Please have a look at this!?

EDIT:

Now I have the following issue:
o.getClass().getName() gives java.util.ArrayList,

o.get(0) gives [Ljava.lang.Object;@739e8329,

and o.get(0).getClass().getName() gives java.lang.String.

I cannot findout what to do..

EDIT2:

Finally I found out what happened. The software that created this object flattened a datastructure into a String (valueOf()). So, when I printed the variable it returned a [Ljava.util.Object, which was in fact a String containing this information.

Thanks guys!

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T17:33:23+00:00Added an answer on May 16, 2026 at 5:33 pm

    [Ljava.lang.Object indicates the type of the object o is an array of Objects – that is Object[]. You cannot cast it to Map.

    You might find it useful if took a look at: java: what is this: [Ljava.lang.Object;?

    You stated that .getClass() indicated Object, but was it Object or [LObject?
    Compare to:

        Object[] array= new Object[]{};
        Object simple = new Object();
    
        System.out.println(array.getClass());
        System.out.println(simple.getClass());      
    

    which prints:

    class [Ljava.lang.Object;
    class java.lang.Object
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some JS code which generates the following object, return { type: some
I have some object that is instantiated in code behind, for instance, the XAML
I have the following code (changed object names, so syntax/spelling errors ignore). public class
I have an object of type element and this has an attribute of type
I have an annotation @MyAnnotation and I can annotate any type (class) with it.
For example, suppose I have the code: class Foo(object): def bar(self, x): '''blah blah
The code is in C. I have two type of objects ( structs )
I have a list of a object Code: List<Code> listCodes = new List<Code>(); I
I have never hand-coded object creation code for SQL Server and foreign key decleration
I have an object with the following properties GID ID Code Name Some of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.