[Solved] Invalid value type: String for Integer

Remove the quotes from around the numbers like this: Map<String, Integer> temp = new Map<String, Integer>{‘type’ => 123, ‘count’ => 1}; EDIT: As you changed your question completely, the best way of achieving this would be: public List<Map<String,String>> getPhoneData() { List<Map<String, String>> mapp = new List<Map<String, String>>(); Map<String, String> temp = new Map<String, String>{‘type’ => … Read more