Multi-layer nested Json parsing

how to deal with multi-layer json, it is the most convenient to get the name? of faith mobile phone.

{
    "data":
    {
        "showStyle":"barscn",
        "areaList":
        [
            {
                "showModel":0,
                "showLen":5,
                "title":"",
                "lines":{
                    "style":{
                        "bgcolor":"ff0000",
                        "fgcolor":"ffffff", 
                        "fontsize":"36", 
                        "fontname":"simhei",
                        "alpha":1.0
                    },
                    "datas":
                    [
                        {   "style":"",
                            "cols":[
                                {"showName":"Nokia","currentShow":true,"style":""},
                                {"showName":"Apple","currentShow":true,"style":""}
                            ]
                        }
                    ]   
                }
            }    
        ]
    }
}

how to deal with it to make it universally applicable

Mar.13,2021

use recursion.


   var arr=[];
function run (v){
    if(v&&v.constructor==Array){
        v.forEach(value=>{
            run(value)
        })
        return
    }
    if(v&&v.constructor==Object){
        for(k in v){
            if(k=='showName'){
                arr.push(v[k])
            }
            run(v[k])
        }
    }
    
}
run(data)
console.log(arr)

JSON.parse ('{json data}') thus becomes object

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5f252-442e3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5f252-442e3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?