JSFiddle - React, Tailwind, and code Playground

JavaScript

var obj = "aloha";

var data = {};
data[obj] = "test";

alert(JSON.stringify(data));