I'm tring to parse a JSON format like this: { "key_1" : { "key_2" : "value" } } and then assign "value" to a variable. Here is my code: var variableShouldBeAssigned: String if let x = (jsonResult["key_1"]? as? NSDictionary) { if let y = (x["key_2"]? as? String) { variableShouldBeAssigned = y } } However, an error occurs when I try to downcast from x["key_2"]? to a String, but it's fine to downcast
![Type 'String' does not conform to protocol 'NSCopying' error when downcast AnyObject to String](https://cdn-ak-scissors.b.st-hatena.com/image/square/98d6f053a97a87156775f60757c60865d0f2c47d/height=288;version=1;width=512/https%3A%2F%2Fcdn.sstatic.net%2FSites%2Fstackoverflow%2FImg%2Fapple-touch-icon%402.png%3Fv%3D73d79a89bded)