const j= { choice1: false, choice2: true }; const map = { true: 'default', ...(j.choice1 ? {[`${j.choice1}`]: 'choice1'} :{}), ...(j.choice2 ? {[`${j.choice2}`]: 'choice2'} :{}) }['true'] console.log(map) // 'choice2'