JSON response from the callout is changed.
1) Current JSON response :
{
XYZ {
}
DEF {
}
MNO {
}
}
Now its changed to :
{
ABC_Stage{
XYZ{
}
}
DEF{
}
MNO{
}
}
Meaning an extra node is added which is also environment specific and for stage its 'ABC_Stage'. I have kept 'ABC_Stage' in a custom setting and retrieving in the code. Similarly for prod, I will configure 'ABC' in the prod custom setting. Now, my challenge is I want to do minimal/no update in the wrapper class because variables used inside XYZ (which has many other nested nodes)I need to traverse those variables and update its references at many places. Also since the inner structure of XYZ still remains the same. I can think of possible solution as:- Create an another method, pass ABC_Stage (after fetching it from the custom setting) and then remove ABC_Stage { } from the response , so the structure looks similar to current JSON and that won't require any change in the wrapper class while deserializing it. Can someone guide me how to achieve this? or any other possible solutions.