• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: JSON validator for Xcode
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: JSON validator for Xcode


  • Subject: Re: JSON validator for Xcode
  • From: Marco Tabini <email@hidden>
  • Date: Tue, 06 Mar 2012 17:51:42 -0500

> 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 isTurnableToJSON the way it's meant to be? My understanding is that its job is to check whether an existing Objective-C object (like an NSDictionary) can be safely converted to JSON, and not to check whether a string contains valid JSON.

From this code, it looks as though you are either trying to validate an NSData object—which you can't, because there's no way to represent NSData in JSON—or a string that has been converted into an NSData object. In either case, you will always get BOOL, and the method is functioning as expected.


—Mt.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >JSON validator for Xcode (From: Alex Zavatone <email@hidden>)
 >Re: JSON validator for Xcode (From: Alex Zavatone <email@hidden>)
 >Re: JSON validator for Xcode (From: Fritz Anderson <email@hidden>)
 >Re: JSON validator for Xcode (From: Alex Zavatone <email@hidden>)

  • Prev by Date: Re: Accessing array in thread safe way
  • Next by Date: Re: Accessing array in thread safe way
  • Previous by thread: Re: JSON validator for Xcode
  • Next by thread: Re: JSON validator for Xcode
  • Index(es):
    • Date
    • Thread