swift - NSArray with contents of file not work in ios -


i trying json array json file in ios. problem code not working content in json file is:

[{a:"m",data:"1597,144",tick:1},{a:"m",data:"1595,144",tick:1}, ...] 

this swift code:

  if let filepath = nsbundle.mainbundle().pathforresource("data", oftype: "json") {      let array = nsmutablearray(contentsoffile: filepath)      println("\(array)")   } 

the file exists @ path reason not working. null when try print array.

nsmutablearray(contentsoffile: filepath) work property lists:

https://developer.apple.com/library/ios/documentation/general/reference/infoplistkeyreference/articles/aboutinformationpropertylistfiles.html

what have json string. if want load array json file check out this: how parse json file in ios?


Comments

Popular posts from this blog

java - Unable to make sub reports with Jasper -

scala - play framework: Modules were resolved with conflicting cross-version suffixes -

Passing Variables from AngelScript to C++ -