美文网首页
处理json对象

处理json对象

作者: shaguamayi | 来源:发表于2019-03-14 15:45 被阅读0次
var json = {
                list: '123',
                list2: '234',
                list3: '345',
                list4: '456',
                list5: '567'
            }
            var listjson = [];
            for (var key in json) {
                listjson.push({
                    name: key,
                    text: json[key]
                })
            }

            console.log(listjson);
image.png

相关文章

网友评论

      本文标题:处理json对象

      本文链接:https://www.haomeiwen.com/subject/ogvcpqtx.html