Swift Convert A String-As-An-Array, To An Array Of Strings
<p>I have a string:</p>

<p><code>"["word1","word2"]"</code></p>

<p>And I want a simple way to convert it to an actual <code>[String]</code>.</p>

<p>All the other questions I could dig up on there were about converting int strings to arrays. </p>

<p>I tried doing </p>

<p><code>Array(arrayLiteral: "["word1","word2"]")</code></p>

<p>But I get</p>

<p><code>["[\"word1\",\"word2\"]"]</code></p>

<p>Manually cleaning up the edges and removing the slashes seems like I'm doing something very wrong. </p>

<p>I'm curious if there's a simple way to convert a an array of strings as a string into an array of strings.</p>

<p>i.e. Convert <code>"["word1","word2"]"</code> to <code>["word1","word2"]</code></p>

<p><strong>Solution</strong> (Thanks to @Eric D)</p>

<pre><code>    let data = stringArrayString.dataUsingEncoding(NSUTF8StringEncoding)

    var stringsArray:[String]!

    do
    {
        stringsArray = try NSJSONSerialization.JSONObjectWithData(data!, options: []) as? [String]
    } catch
    {
        print()
    }

    print("Array is \(stringsArray)")
</code></pre>