Know the terrain before cutting
Surgery begins with imaging. A JSON document of any depth hides its structure from casual reading — the same key at two levels means two different things, an array where an object was expected breaks the rule you were about to write — and the key inventory turns that hidden terrain into a list on paper. Every path appears once, surprises surface before rules are written against them, and the inventory becomes the baseline for everything after: regenerate it after each operation and the diff between inventories is the operation's honest receipt.
Two dialects for addressing
JSON addressing comes in two registers, and confusing them is the common beginner tax. The pointer — RFC 6901 — is an exact address: /data/items/0/price names one node, resolves or fails, and is the dialect JSON Patch itself speaks. The path query — JSONPath or JMESPath style — is a search: wildcards, filters, and projections that return sets of nodes and cost nothing to try. The discipline that keeps them straight is simple — explore with paths, operate with pointers — because an operation that names its target precisely is an operation whose result can be predicted.
Patches are the paper trail
Editing a JSON file directly produces a result; applying an RFC 6902 patch produces a result and a record. The patch is an ordered sequence of named operations — add, remove, replace, move — each targeting a pointer, which makes it readable before it runs, reviewable as a diff, replayable on fresh inputs, and archivable as the audit trail of what was done to the data and in what order. Renaming follows the same logic at the key level: a rule that matches a pattern applies everywhere the pattern lives, and nowhere else — no forty-first manual edit discovered missing after the fortieth looked fine.
Flatten to travel, unflatten to return
Flat key-value rows are the lingua franca of spreadsheets, diff tools, and half the data pipeline world; nested JSON is the native tongue of APIs. The flattener bridges out — nesting collapsed into delimiter-joined keys — and the unflattener bridges back. The guarantee that matters is the round trip: flatten, unflatten, deep-compare against the original, and the structure is proven intact. The one precondition is the collision check — a key containing the delimiter will not survive the trip, so the separator is chosen against the key names actually present, not by habit.
Where this workflow stops
This page reshapes structure and proves the reshape — it does not query for values, convert between formats, or certify a shape. Pulling data out of JSON by query is the extraction and transformation workflow; formatting, validating, and merging documents are the utility workflow's health checks; converting JSON to YAML, CSV, or BSON is the conversion workflow; and turning a structure into TypeScript types or a schema is the typed-code and schema-inference workflows' business. Cut here, verify the round trip, and hand the document to the neighbor that owns the next question.