I am having nearly 400+ fields in a object and during callout I have to send this fields in JSON body.

At present I am manually mapping the fields by keeping all the JSON fields in a object.So the clas itself is having nearly 400+ fields

So mapping like this

Health_SBP__c ----> fv_sbp
Health_DBP__c ----> fv_dbp

Not sure whether my mapping will create any performance issue?. Is there a batter way to map these 400 + fields?

1 Answer 1


If you need to map those values, you'll have to deal with 400+ executions. A typical way to do this is to create a Field Map type object (e.g. as a Custom Metadata Type), grab the CMTs in to a list, and then iterate over those values as you create your JSON. This gives you a configurable way to add/remove fields without modifying code later. There's plenty of examples available on this site and around the Internet that go in to more detail on how to do this.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .