Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
配列の文字列表現があります:
'["item1", "item2", "item3"]'
これを配列に変換しようとしています。
任意のポインタをいただければ幸いです。
使うだけJSON.parse('["item1", "item2", "item3"]');
JSON.parse('["item1", "item2", "item3"]');
JSON.parse を試してください:
ary = JSON.parse(s);
ほとんどのブラウザーはネイティブでサポートしていますが、json.jsが必要になるブラウザーもあります。
また、使用することができます
var genericList = eval('(' + s + ')'); for(i=0;i<genericList.lengthl;i++){ alert("element : " + genericList[i]); }