• 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: Tony Parker <email@hidden>
  • Date: Tue, 06 Mar 2012 13:53:11 -0800

Hi Alex,

On Mar 6, 2012, at 8:38 AM, Alex Zavatone <email@hidden> 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 does not pass the isValidJSONObject test, returning NO.
>

It sounds like you're trying to do something like this:

NSString *s = @" … JSON here …";
BOOL valid = [NSJSONSerialization isValidJSONObject:s];

Which will return 0. Because an NSString by itself is not valid JSON (unless reading using the allow fragments option). The purpose of isValidJSONObject: is to take a Foundation object graph (e.g., NSDictionary objects, NSArray objects, etc) and see if it will work when given to the dataWithJSONObject:options:error: method.

If I'm misunderstanding what you're asking, please post a more complete code sample.

Thanks,
- Tony

> Of course I can plow through the data structure by hand, but I was wondering if there is a way to get more data on just what the reason is why this data fails or if there is an OC friendly JSON validator out there in the wilds somwhere.
>
>
> TIA,
> - Alex Zavatone
>
> _______________________________________________
>
> 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


_______________________________________________

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>)

  • Prev by Date: UIKit-additions and class references
  • Next by Date: Re: Accessing array in thread safe way
  • Previous by thread: Re: JSON validator for Xcode
  • Next by thread: Accessing array in thread safe way
  • Index(es):
    • Date
    • Thread