JSFiddle - React, Tailwind, and code Playground

by Wei Lin Chen

HTML

<div class="box"></div>
<hr/>
<pre class="test"></pre>
<hr/>
<pre class="test2"></pre>
<p/>
<p/>
<p/>

JavaScript

var data = {key1: "value1", key2: "value2", key3: {key4: "value4"}},
    results = JSON.stringify(data, undefined, 2),
    results2 = results.replace(/\n/g, "<br>").replace(/[ ]/g, "&nbsp;");
    results3 = JSON.stringify(data),
console.log(results);
$(".box").append(results2);
$(".test").append(results);
$(".test2").append(results3);