I know there is a question with same title here. But in that question, he is trying to convert a dictionary into JSON. But I have a simple sting like this: \"garden\"
A
Swift 3 Version:
let location = ["location"] if let json = try? JSONSerialization.data(withJSONObject: location, options: []) { if let content = String(data: json, encoding: .utf8) { print(content) } }