Im collecting data via Salesforce inbound email services. I am sending data in json format : { "some_field" : "some_field_value"} with multiple fields.
Im using this code to make the insert:
NPS__c response = new NPS__c();
Map<String, String> m = (Map<String,String>) JSON.deserialize(JSON_from_email, map<String,String>.class);
for (String f : m.keySet()) {
response.put(f, m.get(f));
}
insert response;
where 'JSON_from_email' is obtained by getting the plain text body of an inbound email.
my problem is that one of the fields is an number field { "some_field" : 100 }.
This code fails " Illegal assignment from string to decimal"
I know what the problem is, this produces a string:
JSON.deserialize(splitted_surveys, map<String,String>.class);
how can i change this so that one specific value of the JSON becomes a number?
thanks!