Amazon interview question

iterating a nested json, with recursive approach