JSON array tools — filter, sort, pick fields and paginate in one pass

Paste a JSON array of objects and reshape it in one pass, filtering by field conditions, sorting by any field, keeping only the fields you name and cutting the result into pages.

Live demo · real result from this tool
Sort direction
0 shows all items.
Matched2
Total items
3
Page
1 of 1
Shown
2

Result

[  {    "id": 1,    "name": "Asha",    "city": "Pune",    "score": 92.5,    "active": true  },  {    "id": 3,    "name": "Chen",    "city": "Taipei",    "score": 85.25,    "active": true  }]

Processed on your device — nothing is uploaded.

How to use the JSON array tools

  1. Paste your data into JSON array.
  2. Optionally type a Filter, such as score >= 80 or name contains an. Leave it empty to keep every item.
  3. Type a Sort by field and choose the Sort direction. Leave the field empty to keep the original order.
  4. List fields under Keep only fields (comma separated) to drop the rest.
  5. Set a Page size (0 shows all) and the Page to view, then copy or download the Result.

The counters show Matched, Total items, Page (for example 2 of 5) and Shown.

What it does and when to use it

This is a small, visual stand-in for the filter, sort, map and slice chain you would otherwise write in JavaScript or jq. Use it to trim a large API response to the records and fields a bug report needs, to make a compact fixture for a unit test, to find the top ten items by some value, or to check how a paginated endpoint should split a list.

The filter understands ==, !=, >, >=, <, <=, contains, startsWith, endsWith, matches (a regular expression), in and !in (comma-separated lists), and exists / !exists. Field names can be paths such as meta.w or tags[0].

For filters written one per line with an “any” option and a table view, see JSON query. To view the result as rows and columns, paste it into JSON to table, or turn it into lines for streaming with the JSON Lines converter.

How it works

Everything runs in your browser on the parsed array. Text comparisons in contains, startsWith and endsWith ignore case. Sorting uses the English locale compare with numeric ordering for text, and plain subtraction for numbers. Keep only fields reads each path and stores it under that exact name, so meta.w becomes a key literally called meta.w rather than a nested object. Paging is applied last, and a page number past the end shows the last page.

Worked examples

Files inside {"data": [...]}, filtered with file endsWith .png, sorted by file ascending, keeping file, meta.w:

[{"file":"img1.png","meta.w":400},{"file":"img2.png","meta.w":1600},{"file":"img10.png","meta.w":800}]

Three of four items match, and natural order puts img10.png last.

Same data, no filter, sorted by kb descending, keeping file,kb: the list ends with {"file":"notes.txt","kb":3},{"file":"img1.png","kb":null}, because the null value goes to the end.

[1,2,3,4,5,6,7] with page size 3 and page 3 shows [7] and Page: 3 of 3.

Limits and tips

  • The word “and” only splits conditions when the part after it is a condition, so title == Salt and Pepper stays one condition. Quote a value, as in title == "A and x > 1", if it looks like a condition itself.
  • matches uses a JavaScript regular expression and ignores case.

Frequently asked questions

In what order are the steps applied?
Filter first, then sort, then keep fields, then paginate. So the sort field does not need to be in your list of kept fields, and Matched counts the items after filtering but before paging.
How are text values sorted?
In natural order, so img2.png comes before img10.png, and capital and small letters sort together (apple, Banana, cherry) instead of all capitals first. Numbers are compared as numbers. Items where the sort field is missing or null always go to the end, whichever direction you choose.
My data is inside an object like {"data":[...]}. Does that work?
Yes. If the root is an object, the tool uses the first value in it that is an array. If your array sits deeper, extract it first with the JSONPath tester.
How do I combine several filter conditions?
Join them with && or the word and, for example kb > 50 and meta.w >= 800. All of them must match. For "any of" logic, or one condition per line, use the JSON query tool.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close