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

Saturday, October 12, 2024

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

 

XML to JSON Converter

XML to JSON Converter

JSON Output


    
body { font-family: Arial, sans-serif; background-color: #f4f4f4; margin: 0; padding: 20px; } .container { max-width: 800px; margin: 0 auto; background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); } h1 { text-align: center; color: #333; } textarea { width: 100%; height: 200px; padding: 10px; border: 1px solid #ccc; border-radius: 4px; resize: none; } button { display: block; width: 100%; padding: 10px; background-color: #28a745; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 16px; margin-top: 10px; } button:hover { background-color: #218838; } pre { background-color: #f8f9fa; border: 1px solid #dee2e6; border-radius: 4px; padding: 10px; overflow-x: auto; white-space: pre-wrap; word-wrap: break-word; margin-top: 10px; } document.getElementById('convertBtn').addEventListener('click', function() { const xmlInput = document.getElementById('xmlInput').value; const parser = new xml2js.Parser(); parser.parseString(xmlInput, function (err, result) { if (err) { document.getElementById('jsonOutput').textContent = 'Error parsing XML: ' + err.message; return; } // Convert result to JSON string const jsonString = JSON.stringify(result, null, 4); document.getElementById('jsonOutput').textContent = jsonString; }); });

No comments:

Post a Comment