FR EN ES

JSON Diff & Comparator

Compare two JSON payloads side-by-side and highlight modified, added, and removed keys with semantic precision.

🔒 100% Client-Side Privacy ⚡ < 1ms Instant 📱 Universal Compatibility 🌐 Works Offline (PWA)

Differences & Semantic Analysis:

Why use JSON Diff by TechFlare AI?

Debugging API responses or configuration payloads often involves comparing massive JSON files. TechFlare AI spots semantic differences instantly.

Key Advantages:

  • Semantic Comparison: Compares structural objects regardless of key ordering.
  • Visual Highlight: Green for added keys, Red for deletions, Yellow for modified values.
  • Total Privacy: API secrets and payloads stay 100% local.
Was this tool helpful to you?
(function(){ var leftInput = document.getElementById('jsonLeft'); var rightInput = document.getElementById('jsonRight'); var compBtn = document.getElementById('compareBtn'); var output = document.getElementById('diffOutput'); function formatValue(v) { if(typeof v === 'string') return '"' + v + '"'; return JSON.stringify(v); } function compareObjects(o1, o2, path) { var diffs = []; var allKeys = new Set([...Object.keys(o1 || {}), ...Object.keys(o2 || {})]); allKeys.forEach(function(k){ var curPath = path ? path + '.' + k : k; var in1 = o1 && (k in o1); var in2 = o2 && (k in o2); if(!in1 && in2) { diffs.push('+ [AJOUTÉ] ' + curPath + ': ' + formatValue(o2[k]) + ''); } else if(in1 && !in2) { diffs.push('- [SUPPRIMÉ] ' + curPath + ': ' + formatValue(o1[k]) + ''); } else { var v1 = o1[k]; var v2 = o2[k]; if(typeof v1 === 'object' && v1 !== null && typeof v2 === 'object' && v2 !== null) { diffs = diffs.concat(compareObjects(v1, v2, curPath)); } else if(v1 !== v2) { diffs.push('~ [MODIFIÉ] ' + curPath + ': ' + formatValue(v1) + ' → ' + formatValue(v2) + ''); } } }); return diffs; } function runDiff() { var leftStr = leftInput.value.trim(); var rightStr = rightInput.value.trim(); if(!leftStr || !rightStr) { output.innerHTML = 'Veuillez renseigner les deux objets JSON.'; return; } try { var o1 = JSON.parse(leftStr); var o2 = JSON.parse(rightStr); var diffs = compareObjects(o1, o2, ''); if(diffs.length === 0) { output.innerHTML = '✓ Les deux structures JSON sont parfaitement identiques !'; } else { output.innerHTML = '
' + diffs.length + ' différence(s) détectée(s) :
' + diffs.join('\n'); } } catch(e) { output.innerHTML = 'Erreur de syntaxe JSON : ' + e.message + ''; } } compBtn.addEventListener('click', runDiff); runDiff(); })();