I am passing List attribute as a String to aura action by JSON.stringify

and this is what I am getting in the apex debug --


This is a a list of JSON objects, however I am not able to deserialize into map--

I tried -

List<Map<String,Object>> lstMinorEnrolledBy = (List<Map<String,Object>>) JSON.deserialize(strMinorEnrolledBy, List<Map<String,Object>>.class);

Error message:

Apex Type unsupported in JSON: Object

  • 1
    You should be trying to deserialize into a List<Map<String,String>> Commented Jul 8, 2019 at 18:28
  • 3
    You might like to try JSON.deserializeUntyped.
    – Phil W
    Commented Jul 8, 2019 at 18:33
  • Yeah, that too! Commented Jul 8, 2019 at 18:39
  • I get this after trying your suggestions --Unexpected character ('e' (code 101)): was expecting double-quote to start field name at [line:1, column:3]
    – mvk1991
    Commented Jul 8, 2019 at 18:49
  • Strangely it goes to last debug line and I get this in debug--MVK lstMinorEnrolledBy-->({enrolledbyAdult=0032200000ADlc1AAD, minorDependent=0032200000ADltqAAD})
    – mvk1991
    Commented Jul 8, 2019 at 18:52

2 Answers 2


You just need to change the target data type to List<Map<String,String>>

This works: (checked in dev console)

String str = '[{"minorDependent":"0032200000ADltqAAD","enrolledbyAdult":"0032200000ADlc1AAD"}]';
List<Map<String,String>> lstMinorEnrolledBy = (List<Map<String,String>>) JSON.deserialize(str, List<Map<String,String>>.class);

You can use JSON.deserializeUntyped if you had a case where there was a mix of String and Decimal values:

Object[] rows = (Object[])JSON.deserializeUntyped(strMinorEnrolledBy);
for(Object row: rows) {
    Map<String, Object> values = (Map<String, Object>)row;
    // you can now access values directly

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .