All Rounder Tools Blogger-Best blog for blogger: Text to JSON Tool with colorful styling and all its features use any free library

Saturday, October 12, 2024

Text to JSON Tool with colorful styling and all its features use any free library

 

Text to JSON Tool

Text to JSON Converter

Input Text

Output JSON

body { background-color: #f8f9fa; } textarea { border: 2px solid #007bff; } textarea:focus { border-color: #0056b3; box-shadow: 0 0 5px rgba(0, 123, 255, 0.5); } .btn-success { background-color: #28a745; } .btn-success:hover { background-color: #218838; } .btn-info { background-color: #17a2b8; } .btn-info:hover { background-color: #138496; } document.getElementById('convertBtn').addEventListener('click', function() { const inputText = document.getElementById('inputText').value; const lines = inputText.split('\n'); const jsonOutput = {}; lines.forEach(line => { const [key, value] = line.split(':').map(item => item.trim()); if (key && value) { jsonOutput[key] = value; } }); document.getElementById('outputJson').value = JSON.stringify(jsonOutput, null, 2); }); document.getElementById('copyBtn').addEventListener('click', function() { const outputJson = document.getElementById('outputJson'); outputJson.select(); document.execCommand('copy'); alert('Copied to clipboard!'); });

No comments:

Post a Comment