When I work with JSONs that are not fully known (as in I know all the possible keys and need all of them) I used SwiftyJSON library: https://github.com/SwiftyJSON/SwiftyJSON
It's much easier to work with than the built in JSON decoder
in your case it would be:
var jsonString = "{\"USD\":6385.74,\"JPY\":715249.73,\"EUR\":5582.36}"
let json = JSON(parseJSON: jsonString)
then you can do a bunch of stuff like iterating over keys
for (key, value) in json {
if let currency = key.string {
print (currency,value)
}
}
Check out the documentation in https://github.com/SwiftyJSON/SwiftyJSON