Re: JSON validator for Xcode

2012-03-07 Thread Jens Alfke
On Mar 6, 2012, at 11:59 AM, Alex Zavatone wrote: > BOOL isTurnableToJSON = [NSJSONSerialization isValidJSONObject: responseData]; You’re calling it on the NSData? That’s the wrong way round. You call that method to ask if you can turn an in-memory data structure _into_ JSON data, not to see i

Re: JSON validator for Xcode

2012-03-07 Thread Marco Tabini
> BOOL isTurnableToJSON = [NSJSONSerialization isValidJSONObject: responseData]; > NSLog(@"Is legit for JSON: %d", isTurnableToJSON ); > NSLog(@"Is legit for JSON: %@", isTurnableToJSON ? @"YES" : @"NO"); // > this is how we handle a bool :/ Are you sure that you are using isTurnable

Re: JSON validator for Xcode

2012-03-06 Thread Alex Zavatone
I made the mistake that an NSString would be a legit input var for this. Newb error. On Mar 6, 2012, at 5:11 PM, Jens Alfke wrote: > > On Mar 6, 2012, at 10:27 AM, Alex Zavatone wrote: > >> So I added the validation call: >> >> BOOL isTurnableToJSON = [NSJSONSerialization >> isValidJSONObje

Re: JSON validator for Xcode

2012-03-06 Thread Jens Alfke
On Mar 6, 2012, at 10:27 AM, Alex Zavatone wrote: > So I added the validation call: > > BOOL isTurnableToJSON = [NSJSONSerialization > isValidJSONObject: object] > But running this against the imported JSON result and against my JSON, a the > BOOL never returned 1. It was returned 0, even a

Re: JSON validator for Xcode

2012-03-06 Thread Tony Parker
Hi Alex, On Mar 6, 2012, at 8:38 AM, Alex Zavatone wrote: > I'm in the middle of converting some data to JSON and have successfully run > my files through the JSONLint validator (http://jsonlint.com/). > > However, when trying to convert these files into serialized JSON in Xcode, > the JSON d

Re: JSON validator for Xcode

2012-03-06 Thread Alex Zavatone
I was under the assumption - maybe I can't read documentation - that IsValidJSONObject would check to see if the Foundation object could be turned into a JSON object. From the docs: isValidJSONObject: Returns a Boolean value that indicates whether a given object can be converted to JSON data.

Re: JSON validator for Xcode

2012-03-06 Thread Fritz Anderson
On 6 Mar 2012, at 1:59 PM, Alex Zavatone wrote: > Yeah, I've got the JSON down to this: > > [1] > > and > {"A":1} > > And the code: > BOOL isTurnableToJSON = [NSJSONSerialization isValidJSONObject: responseData]; > NSLog(@"Is legit for JSON: %d", isTurnableToJSON ); > NSLog(@"Is l

Re: JSON validator for Xcode

2012-03-06 Thread Alex Zavatone
Yeah, I've got the JSON down to this: [1] and {"A":1} And the code: BOOL isTurnableToJSON = [NSJSONSerialization isValidJSONObject: responseData]; NSLog(@"Is legit for JSON: %d", isTurnableToJSON ); NSLog(@"Is legit for JSON: %@", isTurnableToJSON ? @"YES" : @"NO"); // this is

Re: JSON validator for Xcode

2012-03-06 Thread Fritz Anderson
On 6 Mar 2012, at 12:27 PM, Alex Zavatone wrote: > So I added the validation call: > > BOOL isTurnableToJSON = [NSJSONSerialization > isValidJSONObject: object] > > But running this against the imported JSON result and against my JSON, a the > BOOL never returned 1. It was returned 0, even a

Re: JSON validator for Xcode

2012-03-06 Thread Alex Zavatone
So I added the validation call: BOOL isTurnableToJSON = [NSJSONSerialization isValidJSONObject: object] But running this against the imported JSON result and against my JSON, a the BOOL never returned 1. It was returned 0, even against JSON that converted properly. Has anyone gotten this