{
  "name": "JSON Prettify & Repair",
  "description": "Paste messy or minified JSON — even with a stray trailing comma — and get clean, indented JSON that's shown and copied to your clipboard.",
  "tags": [
    "json",
    "format",
    "prettify",
    "repair",
    "developer",
    "clipboard"
  ],
  "type": "triggered",
  "nodes": [
    {
      "id": "sticky-intro",
      "position": {
        "x": 20,
        "y": 20
      },
      "data": {
        "color": "#fff266",
        "content": "🧹 Tidy up any JSON.\n\nPress Run. The box below holds a minified, slightly-broken JSON string (note the trailing comma). This flow repairs it, pretty-prints it with indentation, shows the result, and copies it to your clipboard. Edit the box to use your own JSON. Runs locally."
      },
      "type": "stickyNote",
      "width": 360,
      "height": 190
    },
    {
      "id": "trigger-run",
      "position": {
        "x": 120,
        "y": 300
      },
      "data": {
        "instance": {
          "id": "af-base-node:trigger:whenStarted"
        },
        "label": "Run now",
        "inputs": {},
        "parameters": {
          "notes": "Starts the workflow when you press Run."
        }
      },
      "type": "trigger"
    },
    {
      "id": "seed-json",
      "position": {
        "x": 440,
        "y": 300
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:editFields"
        },
        "label": "Your JSON",
        "inputs": {
          "fields": {
            "raw": {
              "type": "string",
              "value": "{\"name\":\"Ada\",\"roles\":[\"admin\",\"dev\"],\"active\":true,\"score\":42,}"
            }
          }
        },
        "parameters": {
          "notes": "Paste the messy JSON you want to clean up here. The default has a trailing comma to show the repair in action."
        }
      },
      "type": "basic"
    },
    {
      "id": "parse-json",
      "position": {
        "x": 760,
        "y": 300
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:json"
        },
        "label": "Repair & parse",
        "inputs": {
          "operation": "parse",
          "value": "{{ $input.raw }}",
          "repair": true,
          "outputFieldName": "data"
        },
        "parameters": {
          "notes": "Repairs the broken JSON (fixing the trailing comma) and parses it into a real object under `data`."
        }
      },
      "type": "basic"
    },
    {
      "id": "stringify",
      "position": {
        "x": 1080,
        "y": 300
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:json"
        },
        "label": "Pretty print",
        "inputs": {
          "operation": "stringify",
          "prettyPrint": true,
          "outputFieldName": "pretty"
        },
        "parameters": {
          "notes": "Serializes the object back into neatly indented JSON text under `pretty`."
        }
      },
      "type": "basic"
    },
    {
      "id": "show",
      "position": {
        "x": 1400,
        "y": 180
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:displayMarkdownNode"
        },
        "label": "Show the result",
        "inputs": {
          "title": "Prettified JSON",
          "content": "```json\n{{ $input.pretty }}\n```"
        },
        "parameters": {
          "notes": "Displays the clean JSON in a code block."
        }
      },
      "type": "basic"
    },
    {
      "id": "copy",
      "position": {
        "x": 1400,
        "y": 420
      },
      "data": {
        "instance": {
          "id": "af-base-node:basic:clipboardWriteNode"
        },
        "label": "Copy to clipboard",
        "inputs": {
          "text": "{{ $input.pretty }}"
        },
        "parameters": {
          "notes": "Copies the prettified JSON so you can paste it anywhere."
        }
      },
      "type": "basic"
    }
  ],
  "edges": [
    {
      "id": "e-run-seed",
      "type": "flowEdge",
      "source": "trigger-run",
      "target": "seed-json"
    },
    {
      "id": "e-seed-parse",
      "type": "flowEdge",
      "source": "seed-json",
      "target": "parse-json"
    },
    {
      "id": "e-parse-str",
      "type": "flowEdge",
      "source": "parse-json",
      "target": "stringify"
    },
    {
      "id": "e-str-show",
      "type": "flowEdge",
      "source": "stringify",
      "target": "show"
    },
    {
      "id": "e-str-copy",
      "type": "flowEdge",
      "source": "stringify",
      "target": "copy"
    }
  ]
}