• 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: Fritz Anderson <email@hidden>
  • Date: Tue, 06 Mar 2012 13:13:59 -0600

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 against JSON that converted properly.
>
> Has anyone gotten this to work?

My next step would be to prosecute my data.

Can you minimize the case? All the JSON-encodable objects are also property-list objects (except NSData and NSDate, maybe NSDecimalNumber; I may be missing others). Try saving a plist file from your data set. If your data won't serialize to plist, that tells you something. Try reducing your data structure to a minimal example that doesn't break, and examine the part that did break it.

Use plutil to convert the plist to XML format (if it isn't already), and load it into a text editor. Good ones will fold collection elements. Plists deserialize to NSDictionary, NSArray, etc., directly. Write a tiny command-line tool that does the JSON conversion. Again, cut down the plist until you've wolftrapped the issue. (Bonus if you use plutil to lint your plists before feeding them to the tool, so you don't get distracted by formatting errors.)

	— F


_______________________________________________

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


  • Follow-Ups:
    • Re: JSON validator for Xcode
      • From: Alex Zavatone <email@hidden>
References: 
 >JSON validator for Xcode (From: Alex Zavatone <email@hidden>)
 >Re: JSON validator for Xcode (From: Alex Zavatone <email@hidden>)

  • Prev by Date: Re: JSON validator for Xcode
  • Next by Date: Re: Efficiency Question...
  • Previous by thread: Re: JSON validator for Xcode
  • Next by thread: Re: JSON validator for Xcode
  • Index(es):
    • Date
    • Thread