Welcome to my blog

I have been working with Salesforce for quite a while, so don’t hesitate to contact me if you have any questions or want some advice.

s f

Subscribe
Follow Us
h

System.JSONException: Apex Type unsupported in JSON: Object

 . Apex  . System.JSONException: Apex Type unsupported in JSON: Object

System.JSONException: Apex Type unsupported in JSON: Object

The Salesforce JSON.deserialize(String, Type) method cannot deserialize from JSON into generic Object, or into objects with generic Object fields. You can deserialize into concrete types such as “String” or “Integer”.

If you have defined your field types as Object, e.g. public Object error, you need to replace Object with the appropriate data type, i.e. StringInteger, etc.

Once you have updated the JSON2Apex generated Apex class with proper data structure then you should fine with deseialize your JSON.

PS. when you use JSON2Apex to generate Apex class by default assign to object since JSON2Apex doesn’t guess what type should for null values.

Post a Comment