Skip to main content
10 events
when toggle format what by license comment
Jan 26, 2021 at 8:38 vote accept Thomas
Jan 25, 2021 at 0:56 comment added Nick C @Thomas How would that work? How would the typecasting know how to convert the list to a map? what would be the map's key? How would it decide what the key would be?
Jan 24, 2021 at 23:46 answer added David Reed timeline score: 2
Jan 24, 2021 at 22:44 comment added Thomas @DavidReed But I should be able to turn the list into a map right? As in: new Map<String, Object>(fieldMap.get('Accts'));
Jan 24, 2021 at 22:37 comment added Phil W @Thomas, JSON deserialization (untyped) turns JSON objects to Map<String, Object> and JSON arrays into List<Object>. Since the JSON has 'Accts' as an array, this means you get a List and that is how you must process it.
Jan 24, 2021 at 22:36 comment added Nick C @Thomas Just because your method expects a map does not mean a list of objects must be a map
Jan 24, 2021 at 22:34 comment added David Reed Your JSON doesn't contain a map for the key Accts. It contains a list. Either your code is incorrect or your JSON is incorrect, but the nature of the error is unambiguous.
Jan 24, 2021 at 22:29 comment added Thomas @NickCook my class GetSobjectFields(sObject newSobj, Map<String,Object> fieldMap ) is expecting a map.
Jan 24, 2021 at 22:26 comment added Nick C Have you tried List<Object> fieldMapLevel_0 = fieldMap.get('Accts'); ?
Jan 24, 2021 at 22:13 history asked Thomas CC BY-SA 4.0