2
votes
Accepted
Convert String of primitive type to a List of primitive type
So long as you know the type you want to convert to, you can use JSON by just wrapping the string in an array [...]:
Integer[] ints = (Integer[])JSON.deserialize('['+value+']', List<Integer>....
- 456k
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
list × 857apex × 524
map × 141
soql × 105
visualforce × 87
trigger × 62
marketing-cloud × 58
set × 48
sobject × 39
json × 34
class × 34
controller × 33
loop × 32
collection × 31
query × 30
lightning-aura-components × 25
unit-test × 25
array × 20
string × 18
wrapper-class × 18
sort × 18
email × 17
custom-object × 17
javascript × 14
error × 14