JSON traversal and transformation
Comes up in: DSA, Coding
This concept is being written. It gets the full five steps — explanation, predict, interview angle, practice with tests, and review cards. Here is exactly what it will cover, so you can study it elsewhere in the meantime.
What it covers
- recursive traversal of nested objects/arrays
- flatten/unflatten
- diffing two JSON objects
- finding paths to a value
- array to tree (parentId → children) and tree to array
- cycle-safe traversal
Words you will know
What you will practise
- json-diff (M)
- array-to-tree (M)
- find-all-paths-to-value (M)
- nested-comments-count (E)
Interview questions this answers
- Convert a flat list of items with
parentIdinto a tree. - Compute the difference between two JSON objects.