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
Kushan.D.JayathilakeKushan.D.Jayathilake 

Blob to base64 then to JSON

Guys,

I have an image stored in Attachment and I want to transfer this image through a REST service. I have tried to use EncodingUtil and convert the blob to Base64 string representation and transfer through my service.

Also I have set of objects in a nested relationship. The Base64 encoded string in the child object, and when I tried to serialize the parent object through JSON.serializePretty(),  it throws the below exception.

System.LimitException: Apex heap size too large: 8693617 External entry point 

How can I overcome of this? Any ideas?