-1

I have Data in MAP<String,sobject> type map and I wants to put it in Map<String,object> type Map. Please help with this casting.

sfdcfox
  • 489,769
  • 21
  • 458
  • 806

1 Answers1

2

Sure, you can just write:

Map<String, Object> widerMap = new Map<String, sObject>();

No casting is required to make this work. However, this is due to a bug in the compiler. If you use this technique, be very careful not to try and store an invalid data type in the value, or you'll get a runtime exception.

sfdcfox
  • 489,769
  • 21
  • 458
  • 806