How to assign it to variable?
dzpt opened this issue · comments
I declared one global variable as NSDirectory here.
var apidata = NSDictionary
and in one method, i assign it value:
self.apidata = JSON.fromURL("(apiurl)");
Error occurred:
'NSDictionary' is not identical to 'AnyObject'
So how can i solve it? What type of your method return?
Try it as array:
var list = []
list = jsondata["data"].asArray!
println(list);
Got error: 2014-09-02 20:02:30.144 Prj[1444:28151] *** NSForwarding: warning: object 0x79675250 of class 'Prj.JSON' does not implement methodSignatureForSelector: -- trouble ahead
Unrecognized selector -[Prj.JSON isNSString__]
I have to write this: var list = json["data"].asArray.
but it not global variable, i only can use in method
I really don't know how to set parsed json value to an global array or directory.
Curious about this as well. Anyone have input?
Me too!
I am having no trouble typing my data as JSON
, like:
let data: JSON = JSON("...")
I think this is in keeping with @dankogai's "vision" of subclassing JSON
to strongly type the underlying schema-less data: it's natural to write data: MyJSONData = MyJSONData(...)
, etc.