Find & Replace (Free Online Tool)

Find and replace matching keys or values across JSON using broad search patterns

Paste your JSON → Get results instantly (no signup)

⚡ Instant resultsNo signupRuns in your browser
Try examples:

Find and replace matching values or keys in this data and clear password fields.

{
"user": "admin",
"password": "s3cret!",
"database": {
"host": "db.example.com",
"password": "db-pass-123"
}
}
Output
1{
2 "user": "admin",
3 "password": "",
4 "database": {
5 "host": "db.example.com",
6 "password": ""
7 }
8}

Love the result?

Use this exact pipeline in your app, backend, or LLM workflow.

No setup needed. Works with curl, Node, Python.

Uses example data. For edited input, copy from the playground.

Read integration guide

Works with:

  • API responses
  • Nested JSON
  • Arrays & objects

Example: input → output

Input / Output
Input
{
"user": "admin",
"password": "s3cret!",
"database": {
"host": "db.example.com",
"password": "db-pass-123"
}
}
Output
{
"user": "admin",
"password": "",
"database": {
"host": "db.example.com",
"password": ""
}
}

Related tools

Advanced usage (optional)

Find & Replace

v1.0.0
Structure
objectarraydestructive

Description

Find & Replace

Find keys or values in JSON and replace them. Supports three modes for different use cases.

Modes

Set Mode (set)

Matches key names exactly and replaces the entire value with the replacement. The replacement is parsed as a JSON value, so you can set fields to strings, numbers, booleans, null, objects, or arrays.

Value Mode (value)

Finds text inside string values and replaces the matched portion. Useful for updating URLs, fixing typos, or transforming text content.

Key Mode (key)

Finds text inside key names and replaces the matched portion. Useful for renaming fields across your JSON structure.

Configuration

FieldTypeDefaultDescription
Modeenumsetset, value, or key
Searchstring(required)Text to find
Replacementstring""Replacement text or JSON value
Case SensitivebooleanfalseWhether matching is case-sensitive
Target Pathspath-picker(all)Optionally limit to specific paths

Replacement Values in Set Mode

The replacement string is parsed as JSON:

  • "" or any text → string
  • null → null
  • true / false → boolean
  • 0, 42, 3.14 → number
  • {} → empty object
  • [] → empty array
  • {"key": "value"} → object

Expressions

The replacement field supports {{expression}} syntax for dynamic replacements. Use old to reference the current value being replaced.

Expression Examples

ExpressionDescription
{{old.toUpperCase()}}Uppercase the matched value
{{old.toLowerCase()}}Lowercase the matched value
{{old.trim()}}Trim whitespace
{{old + '_backup'}}Append a suffix
prefix_{{old}}Prepend a prefix (mixed literal + expression)
{{old.replace("http", "https")}}Sub-replacement within value
{{old.split("@")[0]}}Extract part of a string

How old Works in Each Mode

  • Set mode: old is the current value of the matched key (string, number, boolean, etc.)
  • Value mode: old is the full string value being replaced
  • Key mode: old is the current key name string

Notes

  • Expressions are evaluated safely using an AST parser (not eval)
  • If the replacement contains no {{...}} syntax, it is treated as a plain literal
  • You can mix literal text and expressions: backup_{{old}}_v2

Use Cases

Security & Data Sanitization

  • Clear passwords: Search password, replace with "" — wipe all password fields
  • Redact PII: Search email, replace with [REDACTED] — mask personal info
  • Remove tokens: Search token, replace with null — clear auth tokens
  • Mask credit cards: Search cardNumber, replace with **** — hide payment data
  • Clear secrets: Search secret, replace with "" — sanitize config files
  • Remove API keys: Search apiKey, replace with null — strip credentials

Data Migration

  • Update domains: Value mode, search old-api.com, replace with new-api.com
  • Change API versions: Value mode, search /v1/, replace with /v2/
  • Update protocols: Value mode, search http://, replace with https://
  • Fix environment URLs: Value mode, search staging., replace with production.

Field Renaming

  • Rename abbreviations: Key mode, search fname, replace with firstName
  • Update naming convention: Key mode, search user_name, replace with userName
  • Fix typos in keys: Key mode, search adress, replace with address

Data Normalization

  • Standardize booleans: Set mode, search enabled, replace with true
  • Set defaults: Set mode, search status, replace with "active"
  • Clear deprecated fields: Set mode, search legacyId, replace with null
  • Replace placeholders: Value mode, search TODO, replace with actual value

Examples

Clear Password Fields

Input:

{
  "user": "admin",
  "password": "s3cret!",
  "database": {
    "host": "db.example.com",
    "password": "db-pass-123"
  }
}

Config: mode: set, search: password, replacement: ""

Output:

{
  "user": "admin",
  "password": "",
  "database": {
    "host": "db.example.com",
    "password": ""
  }
}

Redact Email Addresses

Input:

{
  "users": [
    { "name": "Alice", "email": "alice@company.com" },
    { "name": "Bob", "email": "bob@company.com" }
  ]
}

Config: mode: set, search: email, replacement: [REDACTED]

Output:

{
  "users": [
    { "name": "Alice", "email": "[REDACTED]" },
    { "name": "Bob", "email": "[REDACTED]" }
  ]
}

Replace URL Domain

Input:

{
  "api": "https://old-api.example.com/v1/users",
  "docs": "https://old-api.example.com/docs"
}

Config: mode: value, search: old-api.example.com, replacement: api.newsite.io

Output:

{
  "api": "https://api.newsite.io/v1/users",
  "docs": "https://api.newsite.io/docs"
}

Set Tokens to Null

Input:

{
  "name": "Test User",
  "token": "eyJhbGciOiJIUzI1NiJ9.xxxx",
  "refreshToken": "rt_abc123"
}

Config: mode: set, search: token, replacement: null (case-insensitive matches both token and refreshToken)

Output:

{
  "name": "Test User",
  "token": null,
  "refreshToken": null
}
Tip: Enable "Case Sensitive" if you only want to match token exactly and not refreshToken.

Uppercase Values with Expression

Input:

{
  "status": "active",
  "role": "admin",
  "level": "senior"
}

Config: mode: set, search: status, replacement: {{old.toUpperCase()}}

Output:

{
  "status": "ACTIVE",
  "role": "admin",
  "level": "senior"
}
Tip: Expressions use old to reference the current value. Combine with string methods like toUpperCase(), toLowerCase(), trim(), replace(), and split().

Configuration

NameTypeDefaultDescription
Modeenumsetset: match key names and replace the entire value. value: find text inside string values and replace. key: find text inside key names and replace. set value key
Searchstring(required)Text to find (matches key names in set/key mode, string values in value mode)
ReplacementstringReplacement text or value. In set mode this is parsed as JSON (e.g. "", null, 0, false, {}, []). In value/key mode this is plain text. Supports {{expression}} syntax — use {{old}} to reference the current value (e.g. {{old.toUpperCase()}}, {{old + '_backup'}}, prefix_{{old}}).
Case Sensitivebooleanfalse
Target Paths (optional)path-pickerNarrow replacement to specific paths only. Leave empty to apply everywhere.

Examples

AI Prompt
Find and replace matching values or keys in this data and clear password fields.
{
"user": "admin",
"password": "s3cret!",
"database": {
"host": "db.example.com",
"password": "db-pass-123"
}
}
Output
1{
2 "user": "admin",
3 "password": "",
4 "database": {
5 "host": "db.example.com",
6 "password": ""
7 }
8}
Config
Mode
set
Search
password
Replacement
Case Sensitive
OFF

API Usage

POST /api/v1/utilities/structure.find-replace
Example:
curl -X POST https://your-domain.com/api/v1/utilities/structure.find-replace \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"inputs":{"primary":{"user":"admin","password":"s3cret!","database":{"host":"db.example.com","password":"db-pass-123"}}},"config":{"mode":"set","search":"password","replacement":"","caseSensitive":false}}'
Response
1{
2 "user": "admin",
3 "password": "",
4 "database": {
5 "host": "db.example.com",
6 "password": ""
7 }
8}