I'm working on a data integration task and it involves:
receive JSON response from an API GET
POST to another API
Before posting to the other API : convert the payload to another format required by the 2nd API. What I'm doing now is to convert that response json to List, loop through each Dict element to clone to another List but rename the Key value in the process. eg:to "rename" the key from productname to producttitle, quantity to qty..
JSON1=[{'productname':'name1','quantity':2},{'productname':'name2','quantity':2}]
to
JSON2=[{'producttitle':'name1','qty':2},{'producttitle':'name2','qty':2}]
Instead of hardcoding all the mapping rules, I'm wondering if there is a pattern or lib that I should look for to help me maintain the mapping rules say via a config/json file so I can manage/maintain these mapping rules easier?
Thanks