将
*[{"content":"东芝","title":"设备类型标签1"},{"content":"松下","title":"设备类型标签2"}]*
解析成数组
let categoryLabel = []
let jsonStr = [{"content":"东芝","title":"设备类型标签1"},{"content":"松下","title":"设备类型标签2"}]
let jsonObj = $.parseJSON(jsonStr)//json字符串转化成json对象
//var jsonObj = JSON.parse(jsonStr) //json字符串转化成json对象(原生方法)
//let jsonStr1 = JSON.stringify(jsonObj) //json对象转化成json字符串
for (let i in jsonObj){
categoryLabel.push(jsonObj[i])
}
备注:本文参考https://www.cnblogs.com/czh-520/articles/9602801.html