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 - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -