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

Convert JSON data stored in SFDC to Image JPEG file

I have one task that is assigned to me i.e, Convert JSON data (JSON representation of an image) that is stored in to an actual image and store it as an attachment to the same record.


I have the java code for this, but is there any way of doing this with directly, if yes, can anyone help me, giving some direction as what needs to done.
Data is being transmitted in JSON is not via base64
Example of the JSON data that is being stored in 

I would imagine that any image over approximately 140 x 140 (20,000 pixels) wouldn't be possible due to the number of script statements required. That said, I suppose it would be possible to do the following:


1) JSON.decode into a custom object/object list.

2) Loop through the object list and render the individual pixels to a Base64 string stream.

3) Decode the base 64 string into a Blob.

4) Save the file as an attachment/document/etc.




Were you able to solve this? If yes how?


I am also in a situation to do the same.