quikki,
<script>
var objNew = {
text: {
subText: {
value: 'value1'
},
modificator: {
name: 'name1',
params: 'params1'
}
},
attrs: {
title: 'title1'
}
};
function fn(a) {
//a = {...a}
for (var b in a) {
var c = a[b];
if ("object" == typeof c) {
var e = !0;
Object.keys(c).forEach(function(d) {
a[b + "." + d] = c[d]
});
delete a[b]
}
}
return e ? fn(a) : a
};
var obj = fn(objNew);
document.write(JSON.stringify(obj, null, 4))
</script>