Here's the code:
List<SelectOption> options = new List<SelectOption>();
options.add(new SelectOption('One', 'One'));
options.add(new SelectOption('Two', 'Two'));
System.debug(LoggingLevel.INFO, '==========' + JSON.serialize(options));
The error:
System.JSONException: Apex Type unsupported in JSON: System.SelectOption
Is there a way I can convert List<SelectOption>
to some other data type before serializing it? in a way that when I deserialize I get it back as a List<SelectOption>
?