HomePremium · ₹1199
← All questions

Nested object to flat key-value pairs

Medium
Was this asked in an interview?

Flatten a nested object into dot-notation keys.

Problem

Convert { a: { b: { c: 1 }, d: 2 } } into { "a.b.c": 1, "a.d": 2 }.

Nested object to flat key-value pairs — JavaScript Interview Question | Mentoxis