collapse-lib
v1.0.4
Published
Library to collapse an multi-level object into one level object, using dot notation
Downloads
11
Maintainers
Readme
collapseLib
Library to collapse an multi-level object into one level object, using dot notation
Note
This script isn't mine. I just took it from this gist made by alabid
Example use:
var object = {
"obj1key": {
"obj2key": [
{
"obj3key": {
"tell":"me"
}
}
]
},
"obj4key": {
"obj5key": {
"obj6key": "hi!",
"obj7key": "how are you?"
}
}
};
var objectCollapsed = CollapseLib.collapseObj(object);
Results in:
{
"obj1key.obj2key.[0].obj3key.tell": "me",
"obj4key.obj5key.obj6key": "hi!",
"obj4key.obj5key.obj7key": "how are you?"
}