We have a @RestResource apex class using which we are receiving the JSON data from application which resides outside of salesforce through REST API. We parse this data to get the jobId from it and then store it in contentversion and later display this data to user using lightning component. We are receiving the Post API request made by application which contains JSON data in the request body.

If the JSON data in request body contains more than 6 million characters then while converting the requestBody into string for JSONParser we are running into string size exception

String length exceeds maximum: 6000000"

as Apex does not support splitting the blob, is there any alternative way to handle this situation?

global without sharing class ApiCallbackApexCtrl {

    global static String getJob() {
        Blob jobResultBlob = RestContext.request.requestBody; // Ideally I want to split blob if it contains more than 6M characters
        String jobResultToParse = jobResultBlob.toString(); //getting exception here

        // logic to parse the job result using JSONParser which requires string


You must log in to answer this question.

Browse other questions tagged .