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
ryanhca123ryanhca123 

Integration to REST API requires use of reserved words

I'm writing an integration to a REST API that takes JSON as the API input. Several of the objects have properties like "number" and "currency" which are reserved words in Apex. So I've renamed those as "card_number", etc. I want to translate the Apex objects to JSON objects, which will create JSON objects with properties that don't correspond exactly with the API.

 

Is there a better way to fix the resulting JSON other than just doing string manipulation after the fact?

James KentJames Kent

I too am having this problem ... using a predeveloped javascript toolset where I cannot change the name of properties, etc.  Can I use attribute programming or similar to ensure the attribute is mapped when serialized/deserialized?

eblazereblazer

Did you find a solution here?