how to parse string array with SwiftyJSON?

{
    "myArray": ["one", "two", "three"]
}

Using SwiftyJSON, you can get an array of JSON objects with:

var jsonArr:[JSON] = JSON["myArray"].arrayValue

Functional programming then makes it easy for you to convert to a [String] using the ‘map’ function. SwiftyJson let’s you cast string type with subscript ‘.string’

var stringArr:[String] = JSON["myArray"].arrayValue.map { $0.stringValue}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)