DATA · AmpCub data helper
JSON flatten / unflatten
Flatten nested JSON into path keys, or safely restore the hierarchy.
Flatten nested JSON into an RFC 6901 JSON Pointer map, or rebuild the structure with collision and unsafe-path checks.
Local only · prototype-pollution guardPath policy and safety
- Paths use RFC 6901 JSON Pointer: ~ becomes ~0 and / becomes ~1.
- Unflatten treats numeric path segments as array indexes. Numeric object keys are therefore flagged for review.
- __proto__, constructor, and prototype path segments are rejected.
- Collisions, sparse arrays, and ambiguous parent types fail instead of silently overwriting data.
Frequently asked questions
Why /user/name instead of user.name?
Dot paths are ambiguous when keys contain dots; JSON Pointer has precise escaping.
When does unflatten fail?
On type collisions, sparse array indexes, or unsafe segments like __proto__.