Filter JSON fields

Input
Output

Keep or Remove JSON Fields

Keep only the fields you need, or drop the ones you don't. Use a key name to match it anywhere, or a path like customer.city for one place. Works inside arrays too.

Example: keeping a few fields, by name and by path

Keep id and name wherever they are, address.city only inside address, and orders.id inside every order. Everything else is dropped:

Input

{
  "id": 7,
  "name": "Ananya",
  "email": "[email protected]",
  "password_hash": "$2b$12$abc",
  "address": {
    "city": "Pune",
    "pin": "411001"
  },
  "orders": [
    {
      "id": "ORD-1",
      "total": 1499,
      "internal_note": "vip"
    }
  ]
}

Expression

id, name, address.city, orders.id

Output

{
  "id": 7,
  "name": "Ananya",
  "address": {
    "city": "Pune"
  },
  "orders": [
    {
      "id": "ORD-1"
    }
  ]
}

How do I use the Filter JSON fields?

  1. Paste JSON.
  2. Choose keep or remove, and list the keys.
  3. Copy the result.

What does the Filter JSON fields do?

  • Key names or paths
  • Works inside arrays
  • Keep or remove

When to use the Filter JSON fields

Responses usually carry far more than you need. Keep only the fields that matter before you share a payload, write it into a test fixture, put it into a ticket or document an example, or remove fields that shouldn't leave your machine, such as password hashes and internal notes.

List keys separated by commas. A plain name like id matches that key at every level, including inside arrays of objects. A path like address.city matches only that place, and orders.id reaches into every item of the orders array. Mode switches between keeping only these keys and removing these keys; everything else in the document stays exactly as it was.

Frequently asked questions

How is this different from jq?
It's quicker for the common case: list the keys and you're done. For renaming, computing new fields or filtering by value, use the jq or JSONPath tools.
What if a key isn't in the data?
Nothing happens for that key. In keep mode, if none of the keys exist you get an empty object, which tells you the names don't match.
Can I use a path?
Yes. customer.city matches only that field, while city matches it anywhere.
Is my data uploaded?
No. Bracely runs entirely in your browser, so nothing you paste or open leaves your device.

More JSON tools

Bracely has 108 JSON tools in one page. Related ones:

Runs entirely in your browser. Nothing you paste is uploaded. Made by Saurabh Pagrut · About · Privacy policy
Last updated · Version 6.7 · Changelog
Saurabh Pagrut on GitHub · LinkedIn · X · YouTube · Instagram