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.
هل يُرفع أي من المستندين إلى خادم أثناء المقارنة؟
لا، تتم المقارنة بالكامل داخل المتصفح عبر JavaScript دون رفع أي بيانات إلى خارج جهازك.
هل يُؤخذ ترتيب مفاتيح الكائن بعين الاعتبار في نتيجة المقارنة؟
لا، المقارنة البنيوية تنظر فقط إلى البيانات نفسها — وجود الحقل وقيمته ونوعه. ترتيب المفاتيح في كائن JSON ليس ذا دلالة، لذا لا يؤثر على النتيجة.
هل يمكن مقارنة عناصر المصفوفة حسب المعرّف بدلًا من الموضع؟
يعتمد ذلك على خوارزمية المقارنة المستخدمة. أدوات الديف البسيطة تقارن عناصر المصفوفة دائمًا حسب الفهرس؛ الأدوات الأكثر تطورًا تحاول مطابقة الكائنات بحقل مشترك مثل id لإظهار الإدراج أو الحذف بدقة أكبر.