📜  展平嵌套的 json 对象 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:35.310000             🧑  作者: Mango

代码示例1
Object.flatten = function(data) {
    var result = {};
    function recurse (cur, prop) {
        if (Object(cur) !== cur) {
            result[prop] = cur;
        } else if (Array.isArray(cur)) {
             for(var i=0, l=cur.length; i