Is there a generic approach to "compressing" nested objects to a single level:
var myObj = {
a: "hello",
b: {
c: "world"
}
}
compress(myObj) == {
a: "hello",
b_c: "world"
}
I guess there would be some recursion involved, but I figured I don't need to reinvent the wheel here... !?