JSON Formatter
A mini JSON formatter that pretty-prints or reports errors.
Requires Bootstrap 5. Add the CDN tags below to your page (styles in
<head>, scripts before </body>). The downloaded file already includes them.<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"><script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script><div class="card border-0 shadow-sm" style="max-width:320px"><div class="card-body">
<textarea class="form-control form-control-sm mb-2" id="jtInput" rows="2">{"name":"Atlas","ok":true}</textarea>
<button class="btn btn-primary btn-sm mb-2" id="jtBtn">Format JSON</button>
<pre class="bg-light rounded p-2 small mb-0" id="jtOut" style="min-height:50px"></pre>
</div></div>document.getElementById('jtBtn').onclick=function(){var out=document.getElementById('jtOut');try{out.textContent=JSON.stringify(JSON.parse(document.getElementById('jtInput').value),null,2);out.classList.remove('text-danger')}catch(e){out.textContent='Invalid JSON: '+e.message;out.classList.add('text-danger')}};Free to use.This component uses Bootstrap 5 (linked above). Copy any file, or download a ready-to-open .html page with the CDN links already included.