PDF Mikata

วิธีเรียงลำดับคีย์

เผยแพร่: 19 ต.ค. 2026 | อัปเดต: 19 ต.ค. 2026 | เกี่ยวกับ (ภาษาญี่ปุ่น)

ประเด็นสำคัญ
  • วาง
  • ทำเครื่องหมาย

You want to compare two JSONs, but a mass of differences appears just because item order differs. In that case, align the order first with "Sort keys" in Format and Validate JSON and then compare.

ขั้นตอน

  1. Paste the JSON into "Before".
  2. Tick "Sort keys".
  3. Press "Format".
  4. JSON with items in name order appears under "After".
  5. คัดลอกด้วย “คัดลอกผลลัพธ์”
Sorting is by item name (dictionary order). Items inside nesting are sorted too.

Effects of sorting

Steps for comparing

  1. Format each of the two JSONs with "Sort keys".
  2. Paste the results into the tool that finds differences between two texts.
  3. Only the real differences are shown.

What does not change with sorting

Cautions

เหมาะกับ

ตัวอย่าง

Wanted to compare JSON output by two systems. Item order differed, so it was unclear by eye. After sorting both and comparing, only one item actually differed.

Common stumbling blocks

Frequently asked questions

How are numeric item names ordered?

As characters. "10" comes before "2".

สรุป

Align key order before comparing. Array order doesn't change.

ใช้ “จัดรูปแบบและตรวจสอบ JSON” (ฟรี)

เครื่องมือที่ใช้คู่กันได้ดี

หากคู่มือนี้เป็นประโยชน์ ทิปเล็ก ๆ น้อย ๆ จะเป็นกำลังใจอย่างมาก

ส่งทิป (¥300)ส่งของขวัญ (Amazon wishlist)

คู่มืออื่น ๆ ของเครื่องมือนี้

ดูคู่มือทั้งหมด