If you are only looking for opening and closing array brackets at the start and end of your input value, you could replace your is_array(data)
function with the below code. Although the type of your input value will be string anyway.
function is_array(data) {
return data[0] + data[data.length - 1] === "[]"
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…