Tools

JSON sort keys

Rewrite JSON with sorted keys in your browser so diffs and reviews ignore key shuffle. Nothing is uploaded.

Paste JSON, then Format.

How to use the JSON sort keys

  1. Paste JSON.
  2. Click Format. Every object, nested included, is rewritten with keys in alphabetical order.
  3. Copy the result into a review, snapshot test, or log compare.

Why sort keys

Two equal objects can still fail a textual diff because key order changed. Sorting recursively makes the layout about values. Minify after if you need a one-line snapshot.

Nothing is uploaded

Sort uses JSON.parse in this tab. Arrays keep element order; only object keys move.

JSON sort keys FAQ

Are arrays sorted?

No. Array order is data. Only object keys are alphabetized.

Is sort on by default here?

Yes. This page locks sort keys so you cannot forget it.

Pretty or minify?

Format pretty-prints with sorted keys. Minify still sorts, then strips space.

Related tools