Skip to content

Commit 07f43ea

Browse files
committed
fix: format both inputs before diffing for cleaner comparison
1 parent 5da3bc1 commit 07f43ea

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/components/DiffView.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ export default function DiffView() {
1010

1111
function handleDiff() {
1212
if (!left.trim() || !right.trim()) return;
13+
// Format both inputs before diffing so the user sees clean JSON
14+
try { setLeft(JSON.stringify(JSON.parse(left), null, 2)); } catch { /* leave as-is, diffJson will report error */ }
15+
try { setRight(JSON.stringify(JSON.parse(right), null, 2)); } catch { /* leave as-is */ }
1316
setResult(diffJson(left, right));
1417
}
1518

0 commit comments

Comments
 (0)