TL;DR
- Senior frontend work is full of object transformations: API shaping, config merging, redaction, normalization, and deep reads.
- These problems matter because real apps pass complex nested payloads more often than they pass binary trees.
- I treat object questions as production-relevant algorithm practice.
Context
If I am building dashboards, CMS flows, experimentation UIs, or profile editors, I am constantly flattening, grouping, diffing, merging, and validating JSON-shaped data.
The Approach
Practice these 10 medium-level questions:
- Flatten Nested Object Paths — convert nested JSON into dot-path keys.
- Unflatten Object Paths — rebuild nested shape from flattened keys.
- Deep Merge With Array Strategy — merge config trees with explicit array rules.
- Diff Two JSON Payloads — return changed paths and values.
- Redact Sensitive Keys — recursively hide tokens, emails, or secrets.
- Normalize API Records by ID — convert nested arrays to lookup maps.
- Group Objects by Nested Path — e.g.
team.regionoruser.role. - Build Tree From Flat Nodes — parent/child reconstruction from records.
- Deep Equality Ignoring Key Order — compare nested objects predictably.
- Apply Patch Operations — update deep paths without mutating source state.
Try it in the browser
Browser Practice
Object practice: flatten nested object paths
Implement solve(input) and return an object whose keys are dot-separated paths.
Sample Tests
2 checks
Function name:
solveBest for JavaScript / TypeScript / JSON practice snippets.Monospace editorRuns in browser sandbox
Trade-offs
- Object transformations are readable when I keep path semantics explicit; they become brittle when I mix traversal and business rules.
- Immutable updates are safer for UI state, but deep copies can get expensive if I do them carelessly on hot paths.
References
- Related: Coding Practice: Collections
- Related: React State Management