function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

How to replace reserve keywords from JSON Response string?


I need help on replacing reserved keywords with other values in my JSON response string. I have tried with replace and replaceAll methods, but​ I am getting error (System.LimitException: Regex too complicated) because of large JSON response.

Can someone help me  on this issue?​​
can you place a sample JSON reponse? and how are you building the response? Thanks!
Austin GAustin G
The "regex too complicated" error is essentially a heap exceeded error, and is telling you that whatever regex you're using is causing the heap that supports the regex to exceed governer limits. In most cases i've experienced, and colleagues have experienced, the solution is to use a different integration approach. The other option is to break up the input and process each piece separately so you can use less heap memory, but depending on your specific case you may still hit the limits.