JSON
JSON Diff / Compare
दो JSON डॉक्यूमेंट्स की तुलना — क्या जोड़ा, हटाया या बदला गया, हर अंतर के सटीक पाथ के साथ।
Unlike a plain text diff, JSON Diff compares two documents by structure rather than by line: it understands that key order in an object doesn't matter, and it shows the exact path (e.g. user.address.city) to every difference.
How to use it
- Paste the original JSON into one field and the new version into the other.
- The result lists added, removed, and changed fields with the exact path to each and its old and new value.
- Formatting and key order don't affect the result — only the underlying data structure is compared.
Common uses
- Checking exactly what changed in an API response between two versions or two requests.
- Comparing configuration files (package.json, app settings) across branches or environments.
- Debugging a failing test by precisely comparing the expected and actual JSON output.
Things to keep in mind
Array elements are usually compared by position (index) — inserting one element near the start can show every following item as "changed", even though they merely shifted.
The comparison is structural, not textual — two JSON documents with identical data but different formatting or key order are treated as the same.
इस टूल के बारे में लेख: JSON Diff: संरचनात्मक तुलना टेक्स्ट तुलना से कैसे अलग है
अक्सर पूछे जाने वाले प्रश्न
यह टूल किस काम आता है?
यह दो JSON डॉक्यूमेंट्स की तुलना करके बताता है कि क्या जोड़ा, हटाया या बदला गया — हर अंतर के सटीक पाथ के साथ।
क्या तुलना के लिए मेरा JSON कहीं भेजा जाता है?
नहीं, तुलना पूरी तरह ब्राउज़र में होती है — कोई डेटा आपके डिवाइस से बाहर नहीं जाता।
ऐरे के एलिमेंट्स का क्रम बदलने पर 'बदला गया' क्यों दिखता है, जबकि कंटेंट वही है?
ऐरे की तुलना पोज़िशन (इंडेक्स) के आधार पर होती है, कंटेंट के आधार पर नहीं। अगर आप एक जैसे एलिमेंट्स का क्रम बदलते हैं, तो टूल उन्हें सिर्फ़ 'मूव' नहीं बल्कि 'चेंज' के रूप में दिखाता है।
क्या नतीजे में ऑब्जेक्ट की कुंजियों का क्रम मायने रखता है?
नहीं, संरचनात्मक तुलना सिर्फ़ डेटा को देखती है — फ़ील्ड मौजूद है या नहीं, उसकी वैल्यू और टाइप क्या है। JSON ऑब्जेक्ट में कुंजियों का क्रम अर्थपूर्ण रूप से महत्वपूर्ण नहीं है, इसलिए नतीजे को प्रभावित नहीं करता।
क्या ऐरे के एलिमेंट्स की तुलना पोज़ीशन की बजाय आइडेंटिफ़ायर से की जा सकती है?
यह इस्तेमाल हो रहे तुलना एल्गोरिद्म पर निर्भर करता है। सरल diff टूल हमेशा ऐरे के एलिमेंट्स की तुलना इंडेक्स से करते हैं; ज़्यादा एडवांस्ड टूल id जैसी साझा फ़ील्ड से ऑब्जेक्ट को मैच करने की कोशिश करते हैं, ताकि इंसर्शन या डिलीशन को बेहतर तरीक़े से दिखाया जा सके।