JSON Flattener

Convert nested JSON structures to flat key-value pairs with customizable options for delimiters, depth control, and array handling.

Input JSON

Flattened Output

Key Delimiter

Use . for dot notation, _ for underscore, etc.

Max Depth

Leave empty for unlimited depth

Array Handling
Remove Keys by Pattern

Keys containing any of these patterns will be removed from the flattened output

Find & Replace Patterns
Output Format:

About JSON Flattening

What is JSON Flattening?

JSON flattening is the process of converting a nested JSON structure into a single-level flat structure where nested keys are represented using a delimiter (typically a dot). This is useful for:

  • Database Import: Convert nested JSON to flat rows for CSV/database import
  • Data Processing: Simplify data structures for easier programmatic access
  • Mapping: Create field mappings from complex nested objects
  • Configuration: Flatten config files for environment variables or simple storage
  • Analytics: Prepare data for analytics tools that expect flat structures

How It Works

Example:

Original JSON:

{
  "user": {
    "name": "John",
    "email": "john@example.com"
  }
}

Flattened Result:

{
  "user.name": "John",
  "user.email": "john@example.com"
}

Configuration Options

Key Delimiter

Choose how to separate nested keys:

  • . (dot notation)
  • _ (underscore)
  • / (slash)
  • • Custom delimiter

Max Depth

Control nesting depth:

  • • Empty = unlimited
  • • 1 = only top level
  • • 2+ = nested levels

Array Handling

Three array processing modes:

  • • Index: user.0, user.1
  • • Ignore: skip arrays
  • • Stringify: array as JSON

Remove Keys by Pattern

Remove keys containing one or more patterns from flattened output:

  • • Multiple patterns: Click the "Add" button to add more filter patterns
  • • Pattern matching: Keys matching ANY pattern will be removed
  • • Example patterns: audioPath, imageUrl, metadata
  • • Output updates: Apply by clicking "Flatten JSON" button
  • Example: Remove audio/image paths, metadata, internal IDs, etc.

Find & Replace Values

Find keys by pattern and replace their values:

  • • Find: questions.0.id finds all keys with this pattern
  • • Replace: abc replaces matching key values with custom value
  • • Keep original: Original flattened output remains unchanged
  • • Multiple matches: All keys matching the pattern get the new value
  • Example: Replace question IDs, answer IDs, paths, etc. with uniform values