JSON
JSON Sort Keys
ترتيب أبجدي تكراري لمفاتيح الكائنات في JSON — ترتيب عناصر المصفوفات لا يتغير، فقط مفاتيح الكائنات في كل مستوى تداخل.
JSON doesn't guarantee object key order, so two semantically identical documents can look different simply because their fields are in a different order. This tool recursively sorts object keys alphabetically at every nesting level, without touching array element order.
How to use it
- Paste JSON and its object keys are sorted alphabetically instantly, at every level of nesting.
- Pick ascending or descending order as needed.
- Array element order is left untouched — only object keys are sorted, not array values.
Common uses
- Bringing JSON into a canonical form before comparing it with git diff or a text diff tool.
- Normalizing a configuration file for a stable, predictable look in a repository.
- Preparing JSON before computing a content hash, when the result needs to be deterministic regardless of input field order.
Things to keep in mind
Sorting is byte-based (by Unicode code point) — all uppercase letters come before lowercase ones regardless of alphabet, unlike locale-aware sorting.
Only object keys are sorted — array element order carries semantic meaning in JSON, so it's never changed.
مقالة عن هذه الأداة: JSON Sort Keys: لماذا نرتب مفاتيح الكائن
الأسئلة الشائعة
هل يغيّر الترتيب ترتيب عناصر المصفوفات أيضًا؟
لا، الترتيب يطبَّق فقط على مفاتيح الكائنات؛ ترتيب عناصر المصفوفات يبقى كما هو تمامًا لأنها مرتبة حسب الموضع وليس المفتاح.
هل الترتيب تكراري عبر كل مستويات JSON؟
نعم، تُرتَّب مفاتيح الكائنات أبجديًا في كل مستوى تداخل، وليس فقط في المستوى الأعلى.
هل JSON الذي أرتّبه يُرسل لأي خادم؟
لا، الترتيب يتم بالكامل داخل متصفحك عبر JavaScript، دون رفع أي بيانات.
هل تُرتَّب المفاتيح تكراريًا في كل مستويات التداخل؟
نعم، الترتيب لا يُطبَّق فقط على مفاتيح المستوى الأعلى، بل على مفاتيح جميع الكائنات المتداخلة عند أي عمق — وإلا لكانت النتيجة غير متسقة.
هل تؤثر اللغة أو المحلية على ترتيب المفاتيح المرتبة؟
الترتيب حسب البايت (بترميز Unicode) يضع كل الأحرف الكبيرة قبل الصغيرة بغض النظر عن الأبجدية. هذا يختلف عن الترتيب المراعي لقواعد اللغة، الذي يرتب الأحرف بطريقة «طبيعية» بالنسبة للإنسان — الفرق غير ملحوظ لمعظم المفاتيح التقنية، لكن يجدر تذكره للأسماء غير اللاتينية.