There is a dictionary which is formatted as a JSONObject by the following code:
json = try NSJSONSerialization.JSONObjectWithData(data, options: NSJSONReadingOptions())
as! NSDictionary
Data
{
"word": "detrimental",
"results": [
{
"definition": "(sometimes followed by `to') causing harm or injury",
"partOfSpeech": "adjective",
"synonyms": [
"damaging",
"prejudicial",
"prejudicious"
],
"similarTo": [
"harmful"
],
"derivation": [
"detriment"
]
}
],
"syllables": {
"count": 4,
"list": [
"det",
"ri",
"men",
"tal"
]
},
"pronunciation": {
"all": ",dɛtrə'mɛntəl"
},
"frequency": 2.77
}
I'm trying to output the data with a label
label.text = "\(json.valueForKeyPath("results.definition")!)"
But the output looks like this:
(
"(sometimes followed by `to') causing harm or injury"
)
My question is what is the best way to make the output only show the text without "()"?
Is the only way that convert the json data to NSString and split it? I hope there is a better way if possible