javascript
Lodash - object keys conversion to lowercase
If you are using lodash library in your project then you can use its transform() function to convert all object keys to lowercase or uppercase format,
let person = {
"Name": "Richard",
"Company": "Pied Pieper",
"Algo Name": "Compression"
};
var result_obj = _.transform(person, function (result, val, key) {
result[key.toLowerCase()] = val;
});
console.log(result_obj);
Was this helpful?
Similar Posts
- Javascript to convert all object keys to lowercase
- Get all keys from an object using Javascript
- Get number of keys in an object Javascript
- Lodash - Convert paired Array to key value paired object
- Convert all characters to lowercase using toLowerCase() method in javascript
- Loop through object javascript
- JavaScript ES6 filtering object with multiple params