Question: Consider that i have the following html

```
<input type="text" id="other_floor_plans" name="other_floor_plans[]" value="["Pool","Office","Sprinkler","Boiler"]">

```

To fetch the values i use

```
a = $('#other_floor_plans').val()

```

It returns the following 

```
"["Pool","Office","Sprinkler","Boiler"]"

```

If i use a[0], it returns "[" as output. I need to get "Pool" as the first value. 

How to accomplish this?

Answer: 
Your value is a type of `string` which has a correct `JSON` syntax. Just parse with `JSON.parse` into the array and use your syntax.

```js
const value = '["Pool","Office","Sprinkler","Boiler"]';
const array = JSON.parse(value);

console.log(array[0]);
```
You can use `eval` function to convert string to array and get the value.

```
var a = "['Pool','Office','Sprinkler','Boiler']"; // or you can also assign like this var a ='["Pool","Office","Sprinkler","Boiler"]' 
var firstItem = eval(a)[0];
console.log(firstItem);  //output will be "Pool"

```