0

I'm writing a custom python plugin for my software. It takes a List, JSON serializes it, then writes it to a file.

Now, I want to create an OSX app that can read that file. Can someone point me in the right direction to do this? I'm very fluent in Python, not so great in Swift.

Would I want to be using a NSFilewrapper or NSDocument?

Thanks for the help, Joe.

JoeBayLD
  • 939
  • 2
  • 10
  • 25
  • See [`NSJSONSerialization`](https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSJSONSerialization_Class/index.html). You may also want to google something like `NSJSONSerialization swift` to find some useful hints to make things a bit less verbose in Swift than they would be in ObjC. – abarnert Oct 15 '14 at 01:03
  • Thanks for the reply @abarnert. How would I access the object? I have a NSURL. – JoeBayLD Oct 15 '14 at 01:09
  • 1
    You need to read a basic tutorial on these classes. There's a whole chapter on it in the Cocoa user guide, which I can't summarize here nearly as well as the actual guide. But the basic idea is that you fetch the contents of the URL (see the overview section of the [`NSURL`](https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSURL_Class/Reference/Reference.html) docs) as an `NSData`, then you pass that to `JSONObjectWithData`, and then you've got an `NSArray` representing the top-level object, just like your `list` in Python. – abarnert Oct 15 '14 at 01:33

0 Answers0