Lets say we have 2 Javascript objects and an array:
var rawData = { "dModel": "Deluxe", "sizeMB": 256, }; var displayNames = { "dModel": "Device Model", "sizeMB": "Size(MB)" }; var fieldNames = ["dModel", "sizeMB"]; I want to change the field names in rawData according to the mapping indicated by displayNames, the final result should be:
var data = { "Device Model": "Deluxe", "Size(MB)": 256, }; Thanks!