So I’m testing out pulling down JSON data from a site. That works well, data comes in, and if do a lot of grep tests, I can get what I need somewhat easily.
But, if I try to use it with NSJSONSerializationData, I get errors that I’m not sure about what they mean.
code example:
set theReturn to do shell script "/usr/bin/curl -XGET \"" & theServerURL & theServerAPIKey & "&pretty=1\""
(this works, brings down a gob of JSON data as text)
set theJSONDict to current application's NSJSONSerialization's JSONObjectWithData:theReturn options:0 |error|:(missing value)
This is where things go screwy. When I test this in ScriptDebugger, I get: -[__NSCFString bytes]: unrecognized selector sent to instance 0x60000023b500
I’ve tried a few things with theReturn, forcing it to be different variable types, no love. I’ve set options to 0, 1, 2, (missing value), no change. Well, one change, if I set it to missing value, I get a different error message: unable to set argument 3 - the AppleScript value <NSAppleEventDescriptor: ‘msng’> could not be coerced to type Q.
so I’m pretty sure missing value is bad there.
The JSON data that comes down in the curl step seems to be okay, i can post that if it helps.