0

I have a weird problem. So I've created an object where three of the properties of said objects are actually custom types.

So the "merchant" object has "BillingAddress", "BillingDetails", and "authorizer" as properties which are defined as classes.

When I create the object merchant and fill the constructor, the log shows that it has been made, and the 3 custom properties have a reference number. The log also shows that all 3 custom objects have been initialized correctly. (Don't worry, data is made up test data and isn't real).

Please see here for the object showing the properties being created

However, when the serialization to JSON occurs, the API call returns a bad request. Upon investigation, it seems the JSON serialized isn't right.

  1. It seems like the serialized version isn't even the correct JSON Format, please not the ending, it isn't even complete.

  2. For some reason, the RegAddress (Billing Address) has serialized properly but for some reason the Billing Details and the Authorizer have completely been removed from the JSON string. Please see image below of the System.Debug printout.

Please see that the authorizer and the billing details have disappeared whereas the Address seems to have serialized as a nested object.

As you can see it's very bizarre and have no idea why this is happening. The class structures are identical.

1
  • 2
    Hi. I think you need to add the actual apex classes showing the structure to help the community understand your scenario better. Please edit your question to add the details.
    – Phil W
    Apr 30 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.