const obj = { value1: 'bacon', value2: '', value3: 'lard', value4: '', value5: 'cheese', }; Object.keys(obj).reduce((acc, key) => {acc[key] = obj[key] === '' ? null : obj[key]; return acc; }, {})