1. Review the payload
Inspect the JSON tree, decide what should stay, move, or vanish, and sketch the rule sequence. You can type directly in the builder or paste JSON exported from scripts, agents, or an earlier Token Tamer session.
Declaratively reshape JSON inside Token Tamer by composing JSONPath matchers with JSON Patch outputs. This guide captures the user-facing rule syntax, execution order, and guardrails reflected in the npm package and the built-in Tamed Payload panel.
Inspect the JSON tree, decide what should stay, move, or vanish, and sketch the rule sequence. You can type directly in the builder or paste JSON exported from scripts, agents, or an earlier Token Tamer session.
Each rule targets part of the document and emits a patch. Replace can pull values from elsewhere, move shifts data between branches, and rename swaps key labels without copying payloads. Rules run in order, so earlier work feeds later matchers.
Compare originals vs. transformed payloads, validate against an optional schema, and download either the JSON or the rule set. Everything runs locally, so you can replay the same rules inside your own codebase with the npm package.
Rules are plain objects. The builder creates them for you, but you can also author them by hand or source them from your own tooling when you use `json-remap-engine` directly.
type Op = "remove" | "replace" | "move" | "rename"; interface Rule { id: string; matcher: string; // JSONPath expression -> matching nodes become JSON Pointers op: Op; value?: unknown; // replacement payload (strings starting with $ can be JSONPath lookups) target?: string; // destination pointer or JSONPath for move/rename allowEmptyMatcher?: boolean; // silence zero-match warnings when intentional allowEmptyValue?: boolean; // allow blank lookups or empty replacements valueMode?: "auto" | "literal"; // literal mode keeps $foo text untouched targetMode?: "auto" | "pointer" | "jsonpath" | "literal"; // lock how targets are interpreted disabled?: boolean; // skip execution but keep diagnostics visible }
The live operation trace in Token Tamer highlights applied vs. skipped steps, so you can tighten matchers or adjust toggles without guesswork.
Because the engine works on a cloned document, failed rules never corrupt your source JSON—you can iterate safely and keep the best-performing set.
Jump into the live Token Tamer transformer to build rule sets visually, then reuse the same JSON in your automation scripts, CI checks, or npm-based workflows.