Turn a JSON array into an object — keyed by any property of the elements (id, slug, name) for O(1) lookups, or by numeric index. Duplicates and missing keys are flagged, never silently lost.
Show calculation steps
Processed privately in your browser — nothing you paste is uploaded, logged or stored.
From list to lookup table
Arrays are for iteration; objects are for lookup. When your code keeps calling find() on the same array, the data wants to be an object keyed by id — users["b2"] instead of a scan. This converter re-keys an array of objects by any property you choose, and treats the two failure modes honestly: duplicate key values are flagged (later elements overwrite earlier ones), and elements missing the key are preserved under _missing_<index> instead of vanishing.
Worked example
Keyed by id:
[
{ "id": "a1", "name": "Asha" },
{ "id": "b2", "name": "Ravi" }
]becomes:
{
"a1": { "id": "a1", "name": "Asha" },
"b2": { "id": "b2", "name": "Ravi" }
}When to use it
- Building lookup maps and caches from API list responses.
- De-duplicating records by a business key (last one wins — the warning tells you how many collided).
- Preparing data for stores and state managers that want keyed entities.
Limitations to know
- Object keys are strings — numeric ids become “42”, and JavaScript iterates integer-like keys in numeric order.
- Mixed arrays (non-object elements) need “numeric index keys” mode, which keys by position instead.
Common errors and fixes
- Duplicate warning — the chosen property is not unique; pick a different key property or de-duplicate first.
- Reversing it — the Object to Array Converter in merge mode round-trips exactly.
How to use the JSON Array to Object Converter
- Paste a JSON array of objects.
- Enter which property should become the object key (id, slug, email…).
- Click "Convert to object".
- Check the warnings for duplicate or missing key values, then copy the result.
Frequently asked questions
Why convert an array to a keyed object?
Lookups. Finding a record in an array is a scan; in an object keyed by id it is instant — data.users["b2"] instead of a find() call. Keyed objects are the natural shape for caches, maps and de-duplication.
What happens with duplicate key values?
Later elements overwrite earlier ones — objects cannot hold two entries under one key — and the tool warns with a count. If you see that warning, the chosen property is not unique; pick another or de-duplicate first.
What if some elements lack the key property?
They are kept under "_missing_<index>" keys instead of being dropped, and a warning tells you how many. No data is silently lost.
Do numeric keys change anything?
Object keys are always strings, so 42 becomes "42". Be aware that JavaScript objects iterate integer-like keys in numeric order regardless of insertion order.