Imran Shams Imran Shams - 1 year ago 292
Swift Question

Parse UTF8 json file in swift not work correctly with SwiftyJson

I tried to load UTF8 JSON file in swift and I received response in

. Then I converted it to

let responseString = NSString(data: myNSdata!, encoding: NSUTF8StringEncoding)
let json = JSON(responseString)

First print show nil but second print show file correctly but there is
char before each
and I think this is the reason. Please help me to find solution.

Answer Source

No need to make a string to init JSON(), do it with the data:

let json = JSON(data: myNSdata!)