Question: I'm getting this string. (I'm getting Comma Separated Character String from Backend)

```
"seasons": "[7, 9]"

```

I want to iterate the array of Array like this. 

```
// example
this.props.data.seasons.map((element) => console.log(element));

```

How do we convert "[7, 9]" to Array [7, 9]? 

Is it usual for you guys to handle array string?

Answer: 
Use `[JSON.parse](https://www.w3schools.com/js/js_json_parse.asp)` to convert JavaScript object.

```
const tempDict = {"seasons": "[7, 9]"}
JSON.parse(tempDict.seasons)

```
You can do some cosmetic work like below:

```
<script>
        $(function(){
             var mystr = "[7, 9]";
             mystr = mystr.replace("[", "").replace("]", "");
             var myArray = mystr.split(",");

             for (i = 0; i < myArray.length; i++) {
                console.log(jQuery.trim(myArray[i]));
            }
        });
   </script>

```