Question: I have a input with this value and I want to get data and convert to javascript array.
I want to convert this:

```
<input name="news_album" type="hidden" value="[1SoW6zxJ58udU6gfT2G2bSZTf.jpg","2DhY7TjqXeqWNLaVN…DtEH1csjo11.jpg","PN7QSI3lQeQHOdmwfCrjbixkg.png"]">

```

to as a Array in javascript:

```
["1SoW6zxJ58udU6gfT2G2bSZTf.jpg","2DhY7TjqXeqWNLaVN.jpg","DtEH1csjo11.jpg","PN7QSI3lQeQHOdmwfCrjbixkg.png"]

```

Answer: 
assign an id to it and correct the quotes

```
<input id="news_album" name="news_album" type="hidden" value='["1SoW6zxJ58udU6gfT2G2bSZTf.jpg","2DhY7TjqXeqWNLaVN…DtEH1csjo11.jpg","PN7QSI3lQeQHOdmwfCrjbixkg.png"]'>

```

now access the value by id 

```
var valueArray = JSON.parse( document.getElementById( "news_album" ).value );

```

since it was already an array, JSON.parse was enough.
You have 2 options 

1) To use replace and split the string 

```
('["1SoW6zxJ58udU6gfT2G2bSZTf.jpg","2DhY7TjqXeqWNLaVN…DtEH1csjo11.jpg","PN7QSI3lQeQHOdmwfCrjbixkg.png"]').replace(/[\]\[]/g,"").split(',')

```

2) To use [JSON.parse](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse) 

```
JSON.parse('["1SoW6zxJ58udU6gfT2G2bSZTf.jpg","2DhY7TjqXeqWNLaVN…DtEH1csjo11.jpg","PN7QSI3lQeQHOdmwfCrjbixkg.png"]');

```