function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rahul AlladaRahul Allada 

error: Illegal assignment from Object to Map<String,String>

String input = '{"orgId":{"isRequired":"true", "valiateDataType": "Id"},"numOfVehicles":{"isRequired": "true"}}';
Map<String,object> o = (Map<String,object>) JSON.deserializeUntyped(input);
map<string,Id> mapsOfIds = new map<string,Id>();
mapss.put('orgId','003J000001q24JUIAY');
for(string key : mapOfIds.keyset()){
    map<string,string> mapIter = o.get(key);
}

I have a code as above and i am getting the error Illegal assignment from Object to Map<String,String>  at last line where i am assigning mapIter.

Surya GSurya G
Hi Rahul,

In the last line 'o.get(key)' returns an object. it cannot be assigned to map.

You can change the code to following\
for(string key : mapOfIds.keyset()){
    Object obj = o.get(key);
}
Thanks
Surya G