-1

How to mpa top level JSON String Array

JSON Response from server

[
        "tag1",
        "tag2",
        "tag3",
        "tag4",
        "tag5",
        "tag6"
]

I am Using ObjectMapper Swift

harsh_v
  • 3,193
  • 3
  • 34
  • 53

1 Answers1

0

Solved it without ObjectMapper:

On response from server cast the raw JSON into String array

...
..
    case .Success(let request, _, _):
                self.request = request.responseJSON{ json in
                    if json.result.isSuccess {
                        if let tags =  json.result.value as? [String]{ // Cast it as String Array
                            self.remoteTags.removeAll()
                            tags.forEach{self.remoteTags.append($0)}

                        }
                        self.reloadData()
                    }
                }
...
..

[Note: Using Alamofire for Network Operations]

harsh_v
  • 3,193
  • 3
  • 34
  • 53