---
title: "Minify JSON action for ActionClip"
canonical_url: "https://actionclip.app/actions/minify-json"
document_type: "standalone_action"
official: true
action_count: 1
catalog_schema_version: 1
catalog_revision: "2026-08-21.1"
catalog_published_at: "2026-08-20T18:50:00Z"
---

# Minify JSON action for ActionClip

Validate JSON and remove insignificant whitespace.

## What it does

Removes whitespace only outside JSON strings after validation, preserving key order, duplicate keys, escape spelling, and large numeric literals exactly.

## Action details

| Field | Value |
| --- | --- |
| Category | Developer Tools |
| Action type | JavaScript |
| Result | Replace or copy text |
| Internet | Not required |

## Action and outcome

| Action | Outcome |
| --- | --- |
| **Minify JSON** — Selected text: { "large": 9007199254740993, "ok": true } | {"large":9007199254740993,"ok":true} |

## How to validate JSON and remove insignificant whitespace with ActionClip

1. Select the text you want to use.
2. Choose **Minify JSON** from ActionClip.
3. Review the result, then replace the selection or copy the new text.

## Requirements

No setup required.

## Privacy

Runs locally in ActionClip’s JavaScript sandbox. Selected text does not leave your Mac.

## Action configuration

````javascript
function run(selected_text) {
  const input = selected_text.trim();
  try {
    JSON.parse(input);
  } catch (error) {
    throw new Error("Invalid JSON: " + error.message);
  }

  let output = "";
  let inString = false;
  let escaped = false;
  for (const character of input) {
    if (inString) {
      output += character;
      if (escaped) escaped = false;
      else if (character === "\\") escaped = true;
      else if (character === '"') inString = false;
    } else if (character === '"') {
      inString = true;
      output += character;
    } else if (!/\s/.test(character)) {
      output += character;
    }
  }
  return output;
}
````

## Links

- [HTML listing](https://actionclip.app/actions/minify-json)
- [Download action definition](https://actionclip.app/actions/minify-json.actionclip)
- [Browse Developer Tools actions](https://actionclip.app/marketplace#marketplace-developerTools)
- [All Marketplace listings](https://actionclip.app/marketplace)
