JSON keys, values and entries
List the keys, the values or the key and value pairs of a JSON object.
Your result
Your result will appear here.
About JSON keys, values and entries
Use this to take a JSON object apart into a list. Keys shows at a glance which fields an API response, a settings file or a record contains. Values pulls the right-hand side out of a lookup object, such as country codes mapped to country names. Key and value pairs gives [key, value] pairs, a shape that is easy to loop over, sort or show as a 2-column table. Each result is a JSON array.
How it works
StillKit parses the text as strict JSON, checks its size limits and requires the outer value to be an object. It then lists that object's own keys, its values or both, in the order JavaScript keeps them: keys that are whole numbers first, in numeric order, then the rest as written. Values keep their types, and a nested object or array is copied whole into the list.
Tips
- Only the outer object is listed, so nested keys such as city inside address do not appear. JSON path list shows keys at every depth.
- With Values, the key names are dropped, so a value can no longer be traced to its key. Key and value pairs keeps both.
- Keys and Values come out in the same order, so the 2 results line up item by item.
- Each pair is a 2-item array with the key first. JSON to CSV needs an array of objects, not pairs, so turn pairs into objects before building a spreadsheet from them.
- The input must be an object. For an array of records, try JSON array pluck or JSON structure inspector.
Limits
Maximum 1 MB input, 100 levels of nesting and 50,000 nodes. JSON only; no expressions are evaluated. Output is inert text. Number precision follows JavaScript; use strings for large exact integers. Only the top level of one object is listed.
How tools run on your device →A worked example
Example input
JSON: {"name":"Asha","active":true,"scores":[92,88],"address":{"city":"Colombo"}}
List: KeysExample result
[ "name", "active", "scores", "address" ]
Questions and answers
Why are my keys in a different order than in the file?
Keys that look like whole numbers, such as "2" and "10", are listed first in numeric order, ahead of the other keys, which keep the order they were written in. JavaScript stores object keys that way, so all 3 lists follow it.
Which list should I choose?
Keys to see what fields exist, Values to collect the data without its labels, and Key and value pairs when you need both together, for example to sort the fields or to fill a 2-column table.
Can it list the keys of every object in an array?
No, it reads one object. For a list of records, JSON array pluck takes one property from every record, and JSON path list shows every key and value in the whole document with its path.