Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

rename json key object

const renameKey = (object, key, newKey) => {

  const clonedObj = clone(object);

  const targetKey = clonedObj[key];



  delete clonedObj[key];

  clonedObj[newKey] = targetKey;

  return clonedObj;

};
Source by jetrockets.com #
 
PREVIOUS NEXT
Tagged: #rename #json #key #object
ADD COMMENT
Topic
Name
9+8 =