Apologies for the confusion in my previous explanation. Let me clarify my question:
In my Angular 4 application, I am using json2typescript to handle JSON to object conversion. However, I am facing an issue where the class structure I have defined does not match the structure of the JSON response from an external API. Here is an example:
Customer {
@JsonProperty('idCardNumber', String)
idCardNumber: string = undefined;
@JsonProperty('rolInfo.name',String)
name: string = undefined;
@JsonProperty('rolInfo.surname',String)
surname: string = undefined;
}
JSON response from External API:
{
"idCardNumber": "08989765F",
"rolInfo": {
"name": "John"
"surname: "Smith"
}
}
My goal is to map the above JSON structure to my Customer object without altering my class structure. I have attempted to include 'rolInfo.name' in the JsonProperty but it did not produce the desired outcome.