JSON Array ↔ Object
Reshape between arrays and objects. Turn an array of records into a lookup object keyed by id, group records by a shared field, index by position — or go the other way and expand an object back into an array, with the key folded in as a field.
How to reshape a JSON array into an object
- Paste your JSON — an array for the first three modes, an object for the last three.
- Pick a Direction.
- For keying and grouping, set the Key field name. Dotted paths work, so
user.idis fine. - Tick Remove the key field if it would be redundant once it is the object key.
- Copy or download the reshaped JSON.
Which mode do I want?
- Key by a field — builds a lookup table.
{"a": {…}, "b": {…}}gives O(1) access by id instead of scanning an array. Duplicate keys mean the last record wins, so dedupe first if that matters. - Group by a field — one bucket per distinct value, each holding an array. This is what you want for "records per status" or "events per user".
- Key by position —
{"0": …, "1": …}. Occasionally needed by form encoders and older template engines. - Object → array — the reverse of keying. The object key becomes a field on each record, so no information is lost.
- Entries —
[{"key": …, "value": …}], mirroringObject.entries(). Works when the values are scalars, not just objects. - Values only — discards the keys, mirroring
Object.values().
Privacy
Nothing is uploaded. The conversion runs in this tab using your own browser's JavaScript engine — no server sees your data, and the page keeps working with the network disconnected.
FAQ
What happens to records missing the key field?
They are kept under a generated __missing_N key so nothing is silently dropped, and the status bar counts them. Find them first with Filter array and id missing.
Will duplicate keys lose data?
In key by mode, yes — the last record with that key wins. Use group by instead to keep every record, or dedupe first to decide deliberately which one survives.
Are numeric keys turned back into numbers?
In Object → array mode, yes — a key like "42" becomes the number 42 in the folded-in field, since JSON object keys are always strings but the original value probably was not.