I have an object, I would like to flatten that using jquery / underscore. Any one help me the shortest way to do this?
Here is my actual object :
var testObj = {
    "name": "Tester",
    "age": "32",
    "address": {
        "street1": "abc",
        "houseObj": {
            "houseName": "somename"
        }
    },
    "marks": [
        {
            "eng": 80
        },
        {
            "maths": 98
        }
    ]
};
I am looking the output is :
var flattenedObj = {
                "name": "Tester",
                "age": "32",
                "address.street1": "abc",
                "address.houseObj.houseName": "somename",
                "marks.0.end": 80,
                "marks.1.maths": 98 
}
Any one give me the short way to do this?
 
    