Timeline for How to deserialize array of JSON objects to an APEX Map
Current License: CC BY-SA 3.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 17, 2019 at 14:14 | comment | added | balinder singh |
Yeah I know, if for example we have following fields: fields,success and then message,error i can create one object adding all these but my question here is 'body' in above mentioned json where it could be an array and same time it could be an object in other item response
|
|
Apr 17, 2019 at 13:58 | comment | added | sfdcfox♦ | @balindersingh You'd create a combined structure that has the attributes of both. You can't use different classes, but as long as the overlapping members are of the same type, you can combine them. | |
Apr 17, 2019 at 13:14 | comment | added | balinder singh |
Can we use class typed deserialization when there is a variation in JSON structure .. see body attribute in SF composite API response where it could be an array or an object : { "compositeResponse": [ { "body": { "id": "001R00000033I6AIAU", "success": true, "errors": [ ] } }, { "body": [ { "message": "Email: invalid email address.", "errorCode": "INVALID_EMAIL_ADDRESS", "fields": [ "Email" ] } ] } ] }
|
|
Jun 16, 2016 at 15:02 | history | answered | sfdcfox♦ | CC BY-SA 3.0 |