JSFiddle - React, Tailwind, and code Playground
JavaScript
function cleanIt(obj) {
var cleaned = JSON.stringify(obj, null, 2);
return cleaned.replace(/^[\t ]*"[^:\n\r]+(?<!\\)":/gm, function (match) {
return match.replace(/"/g, "");
});
}
var obj = {
name: "John Smith",
favoriteObjects: [
{ b: "there's", c: "always", d: "something" },
[1, 2, "spam", { f: "hello" }],
{ vowels: "are missing" },
],
favoriteFruits: ["Apple", "Banana"],
};
document.body.innerHTML = `<pre>${cleanIt(obj)}</pre>`;