I need to convert a js object to another object for passing onto a server post where the names of the keys differ for example
var a = { name : "Foo", amount: 55, reported : false, ... <snip/> ... date : "10/01/2001" } needs to turn into
a = { id : "Foo", total : 55, updated: false, ... <snip/> ... issued : "10/01/2001" } where I have lookup obj available for mapping all the keys
var serverKeyMap = { name : "id", amount : "total", reported : "updated", ... date : "issue" } Is there a function available in underscore.js or jQuery that I can use that does this functionality?
thanks