Skip to main content
All CollectionsRule documentationOptimizations
Use of JSON serialization of exceptions

Use of JSON serialization of exceptions

David Martin avatar
Written by David Martin
Updated over a week ago

Summary

Starting from API version 63.0, Apex no longer supports JSON serialization of custom exception types and most built-in exceptions. Attempting to serialize an exception, directly or as part of an object now triggers a runtime error:
​

System.JSONException: Type unsupported in JSON: MyException


This change is versioned behavior. In API 62.0 and earlier, exception types could be serialized, but the results were inconsistent and often triggered unexpected serialization errors or missed important fields.
​

Scope

  • Apex Classes

  • Apex Triggers (indirectly if exception handling is performed inside methods)

Resources

Did this answer your question?