Basic Usage
This guide covers the fundamental operations of the JSON Diff Tool, helping you get started with comparing JSON objects effectively.
Interface Overview
The JSON Diff Tool interface consists of several key sections:
Input Areas
- JSON A: First JSON object for comparison
- JSON B: Second JSON object for comparison
- Validation Status: Real-time validation indicators for each input
Toolbar
- Format: Beautify and format JSON input
- Clear: Clear both input areas
- Swap: Exchange the contents of JSON A and JSON B
- Copy Diff: Copy the difference results to clipboard
- Save to History: Save current comparison to history
Results Section
- Tree View: Visual representation of differences
- Statistics: Summary of changes (unchanged, modified, added, removed)
Step-by-Step Usage
1. Enter JSON Data
Method 1: Direct Input
- Click in the "JSON A" text area
- Type or paste your first JSON object
- Click in the "JSON B" text area
- Type or paste your second JSON object
Method 2: Load Examples
- Scroll to the "Examples" section
- Click on any example card
- The tool will automatically load sample data
2. Validate JSON
The tool automatically validates JSON as you type:
- Valid JSON: Green badge with "Valid" status
- Invalid JSON: Red badge with "Invalid" status
- Error Indicators: Red border and alert icon for invalid JSON
Common JSON Validation Issues
- Missing Quotes: Property names must be in double quotes
- Trailing Commas: Remove commas after the last item
- Unclosed Brackets: Ensure all
{and[are properly closed - Invalid Characters: Check for special characters in strings
3. View Differences
Once both JSON objects are valid, the tool automatically displays:
Tree View
- Green: Unchanged values
- Yellow: Modified values
- Blue: Added values
- Red: Removed values
Statistics Panel
- Unchanged: Number of unchanged properties
- Modified: Number of modified properties
- Added: Number of new properties
- Removed: Number of deleted properties
4. Interpret Results
Understanding the Tree View
root
├── unchanged_property: "same value" (green)
├── modified_property: "old" → "new" (yellow)
├── new_property: "added value" (blue)
└── deleted_property: "removed value" (red)
Reading Statistics
- High Unchanged Count: Minimal changes between objects
- High Modified Count: Many existing values were updated
- High Added Count: Many new properties were introduced
- High Removed Count: Many properties were deleted
Common Operations
Formatting JSON
- Click the "Format" button in the toolbar
- Both JSON inputs will be beautified with proper indentation
- Invalid JSON will remain unchanged
Clearing Data
- Click the "Clear" button in the toolbar
- Both input areas will be emptied
- All results will be cleared
Swapping Inputs
- Click the "Swap" button in the toolbar
- The contents of JSON A and JSON B will be exchanged
- Differences will be recalculated automatically
Copying Results
- Ensure both JSON objects are valid
- Click the "Copy Diff" button
- The difference results will be copied to your clipboard
- Paste the results wherever needed
Input Tips
Valid JSON Examples
Simple Object
{
"name": "John Doe",
"age": 30,
"city": "New York"
}
Nested Object
{
"user": {
"id": 1,
"profile": {
"name": "John",
"email": "john@example.com"
}
}
}
Array of Objects
[
{ "id": 1, "name": "Item 1" },
{ "id": 2, "name": "Item 2" }
]
Common Input Mistakes
❌ Invalid JSON
{
"name": "John", // Missing quotes
"age": 30, // Missing quotes
"city": "New York" // Trailing comma
}
✅ Valid JSON
{
"name": "John",
"age": 30,
"city": "New York"
}
Keyboard Shortcuts
Navigation
Tab: Move between input areasShift + Tab: Move backwards between areasCtrl/Cmd + A: Select all text in current area
Operations
Ctrl/Cmd + C: Copy selected textCtrl/Cmd + V: Paste textCtrl/Cmd + Z: Undo (in input areas)Ctrl/Cmd + Y: Redo (in input areas)
Troubleshooting
No Differences Shown
Possible Causes:
- One or both JSON inputs are invalid
- JSON objects are identical
- Input areas are empty
Solutions:
- Check validation status badges
- Ensure both inputs contain valid JSON
- Verify the objects are actually different
Invalid JSON Error
Common Issues:
- Missing quotes around property names
- Trailing commas
- Unclosed brackets or braces
- Invalid escape sequences
Solutions:
- Use the "Format" button to auto-fix common issues
- Check for syntax errors manually
- Use a JSON validator tool
Performance Issues
For Large JSON Objects:
- Break down very large objects into smaller parts
- Use the browser's developer tools to monitor performance
- Clear browser cache if needed
Best Practices
Input Preparation
- Validate First: Ensure your JSON is valid before comparison
- Use Examples: Start with provided examples to understand the tool
- Format Consistently: Use the format button for consistent indentation
- Check Size: Very large JSON objects may impact performance
Result Interpretation
- Start with Statistics: Review the summary before diving into details
- Use Tree View: Navigate the tree structure to understand changes
- Focus on Changes: Pay attention to modified, added, and removed items
- Save Important Comparisons: Use history to track significant changes
Workflow Integration
- API Testing: Compare API responses before and after changes
- Configuration Management: Track changes in configuration files
- Data Migration: Verify data transformation accuracy
- Quality Assurance: Validate expected changes in test data
The basic usage of the JSON Diff Tool is straightforward, but mastering these fundamentals will help you make the most of its powerful comparison capabilities.