+ Start a Discussion
sakthidharan Ambayiramsakthidharan Ambayiram 

System.JSONException: Unexpected character ('"' (code 34)): was expecting comma to separate OBJECT entries at [line:1, column:31]

@isTest
global class CQP_ClsTriggerOpportunityHttpResGen implements HttpCalloutMock{

    // Implement this interface method
    global HTTPResponse respond(HTTPRequest req) {      
        HttpResponse res = new HttpResponse();
        res.setHeader('Content-Type', 'application/json');
		res.setBody('{"TYPE":"type","SAPID":"1234"","NUMBER":"100","MESSAGE":"message","LOG_NO":"log_no","LOG_MSG_NO":"100","MESSAGE_V1":"msg1","MESSAGE_V2":"msg2","MESSAGE_V3":"msg3","MESSAGE_V4":"msg4","PARAMETER":"param","ROW":"row","FIELD":"field","SYSTEM":"system"}');
        res.setStatusCode(200);
        res.setStatus('OK');
        return res;
    }
}

***************main class ****************
List<Object> results = (List<Object>) JSON.deserializeUntyped(res.getBody());
for (Object mp: results) {
System.debug('>>'+(Map<String, Object>)mp); 
Map<String, object> jsonRespMap = (Map<String, Object>)mp;
Boolean result = Boolean.valueof(jsonRespMap.get('success'));
if(result == true){
afterUpdateSuccess(opty1);
}

Error details:
Error MessageSystem.JSONException: Unexpected character ('"' (code 34)): was expecting comma to separate OBJECT entries at [line:1, column:31]
Stack TraceClass.System.JSON.deserializeUntyped: line 11, column 1
AnudeepAnudeep (Salesforce Developers) 
Hi, 

Looks like an Invalid JSON

Can you please take a look at this post

http://​​​​​​​https://developer.salesforce.com/forums/?id=906F0000000B3IEIA0 (http://https://developer.salesforce.com/forums/?id=906F0000000B3IEIA0) and see if it helps? 

Anudeep
Albino Noynay JrAlbino Noynay Jr
Please remove the extra double quote on the following paramater.
"SAPID":"1234"",
ridorex yunchaliridorex yunchali
Epayitonline is an online payment gateway specifically designed to pay medical bills. Anyone can visit Epayitonline (http://epayitonline.live/) and pay their bills without any hassle of visiting medical store.