Hello,
I’m currently facing an issue while working on a custom JSON service within Dynamics 365 for Finance and Operations, and I’m seeking your support.
My goal is to create a generic service, where i can using extension add more fields based on customers needs.
I’ve successfully created a custom JSON service that accepts an input data contract. However, when I extend this data contract with a subclass to include additional fields, the new values are not being read correctly, even though the JSON payload is structured properly and includes the additional fields.
This is the JSON:
{
"REQUEST":
{
"DATA":
[
{"A": "123", "B": "XXX", "C": "999"},
{"A": "456", "B": "YYY", "C": "888"}
]
}
}
Here’s a brief outline of the problem:
- This is the service method:
public AAAResponse post(
AAARequest REQUEST)
{
AAAResponse response = new AAAResponse();
List data = REQUEST.parmDATA();
..
return response;
}
- This is the AAARequest data contract class, it contains a list of AAAData class
[DataContractAttribute]
public class AAARequest
{
List data = new List(Types::Class);
[DataMemberAttribute("DATA"),
DataCollectionAttribute(Types::Class, classStr(AAAData)),
AifCollectionType("_DATA", Types::Class, classStr(AAAData)),
AifCollectionType("return", Types::Class, classStr(AAAData))]
public List parmDATA(List _DATA = data)
{
data = _DATA;
return data;
}
}
This is the contract where i define fields, in base classe only "A"
public class AAAData
{
str a;
[DataMemberAttribute("A")]
public str A(str _a = a)
{
a = _a;
return a;
}
}
- I’ve created in another model a class that extending the base contract to add new fields, in this case "C".
[ExtensionOf(classStr(AAAData))]
public final class AAAData_Extension
{
public str c;
[DataMemberAttribute("C"), Newtonsoft.Json.JsonExtensionDataAttribute]
public str C(str _c = c)
{
c = _c;
return c;
}
}
- Only the fields from the base contract are being read, while the fields from the extended contract are ignored.
The service reads the BaseField correctly, but the ExtendedField is not being processed, even though it is present in the JSON payload.

My opinion is the JSON deserialization for some kind of reason does not "know" extension fields
Has anyone encountered a similar issue when extending a data contract in a custom service?
Are there any specific steps or configurations I need to ensure for the service to recognize the extended data contract fields?
Any guidance or suggestions would be greatly appreciated!
Thank you in advance for your help!
Best regards,
Diego