[swift-corelibs-dev] NSJSONSerialization start

David Owens II david at owensd.io
Sat Dec 5 03:20:15 CST 2015


I started taking a look at the `NSJSONSerialization` work that needs to be done. I’ll send a pull-request for what I have once I get some more tests running. Anyone interested can see the first commit here: https://github.com/owensd/swift-corelibs-foundation/commit/29c840fa7089dd9370d8199591dbbeb733a0105f <https://github.com/owensd/swift-corelibs-foundation/commit/29c840fa7089dd9370d8199591dbbeb733a0105f>.

That said, I’ve already seen some issues, I logged a couple here:

  - https://bugs.swift.org/browse/SR-71 <https://bugs.swift.org/browse/SR-71>
  - https://bugs.swift.org/browse/SR-72 <https://bugs.swift.org/browse/SR-72>

Another problem is how NSJSONSerialization works today. When things are not right (such as an invalid top-level JSON object), exceptions are raised. Obviously, this is not good. The function is marked with `throws` so I’ve started a new `ErrorType` implementation. I’ve started one here:

    public enum NSJSONSerializationError : ErrorType {
        case InvalidTopLevelType
        case InvalidKeyTypeForObject
        case InvalidValueType
    }

I’m not sure what the process really is here and how iterative you really want our pull requests. Any info would be helpful.

Thanks,
-David

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-corelibs-dev/attachments/20151205/00922994/attachment-0001.html>


More information about the swift-corelibs-dev mailing list