I have an apex class which is exposed as a rest API, It sends field value of a custom metadata type in response. My response string is like this -
string respString = '{"success":'+true+',"customMetVal":'+JSON.Serialize(customMetVal[0])+',
"account":'+JSON.Serialize(account[0])+'}'
while testing this class in sandbox, I get complete code coverage but when I try validating in my production org, I get this error:
System.JSONException: Unexpected character ('E' (code 69)): expected a valid value (number, String, array, object, 'true', 'false' or 'null') at input location [1,2]
I need some insights on what I am doing wrong, Is this response that I am sending from apex class not right or do I need to deploy custom metadata type before deploying apex class or anything else which I am not able to see. Also, in my custom metadata type, I have a field which contains value like this -
"Custom_Field__c": "Hi! Greetings, “We can’t help everyone, but everyone can help someone” (Ronald Reagan)."
Is the JSON exception because of this feildfield value,? If so then why I am not getting error while testing in sandbox?