• 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: Jens Alfke <email@hidden>
  • Date: Tue, 06 Mar 2012 17:06:28 -0800

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 if JSON data is parseable.

In other words, the parameter to isValidJSONObject: should be an NSArray or an NSDictionary, otherwise it’s always going to return NO.

—Jens
_______________________________________________

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: No indentation when displaying an icon in an NSMenuItem
  • Previous by thread: Re: JSON validator for Xcode
  • Next by thread: Re: JSON validator for Xcode
  • Index(es):
    • Date
    • Thread