正当な JSON オブジェクトと検証済みの JSON オブジェクトの両方の解析に問題があります。
これは問題なく動きます
var response = {"tags":"[{\"value\": 2,\"label\": \"Dubstep\"},{\"value\": 3,\"label\": \"BoysIIMen\"},{\"value\": 4,\"label\":\"Sylenth1\"}]"};
var tags = $.parseJSON(response.tags);
console.log(tags);
コンソールに出力されますArray[3]
しかし、実行すると、の値var response
をこれに変更します
var response = {"tag":"[{\"id\":2,\"name\":\"Dubstep\",\"description\":\"Dub wob wob\"},{\"id\":3,\"name\":\"BoysIIMen\",\"description\":\"A 1990s Boy Band\"},{\"id\":4,\"name\":\"Sylenth1\",\"description\":\"A VST Plugin for FLStudio \"}]"};
の値はtags
、null
両方の値が JSONLint で検証されることに注意してください。