from Hacker News

Debunking the myths about parsing JSON in Swift

by jtbrown on 2/18/16, 1:30 PM with 14 comments

  • by seivan on 2/18/16, 2:35 PM

    Yes! Someone finally said it. The worst are the operators. You don't need these libraries and their lack of tests.

    Noticed this might be an ad about a book... Parsing JSON in Swift. The bubble is real. What developer would buy this? What's next, a book about NSURLSession?

  • by mpweiher on 2/18/16, 4:14 PM

    And here's your regularly scheduled announcement that the actual JSON parsing is done by the library call NSJSONSerialization.JSONObjectWithData(...) in line 3 of the code.

    The rest is just getting the parsed data out of already parsed nested dictionaries and arrays in a way that makes the type checker happy. Calling that "parsing" is probably the biggest myth of them all (though agreed about all the other myths).

  • by hxucaa on 2/18/16, 3:32 PM

    Swiftz (https://github.com/typelift/Swiftz) offers well tested implementation of operator definitions and constructs from functional language. It takes inspiration from Scalaz and Haskell. If I were to write a library using wacky operators, I'd at least use well defined and maintained definitions.
  • by wrong_variable on 2/18/16, 3:54 PM

    Why is parsing JSON a problem in 2016 ?
  • by seanalltogether on 2/18/16, 4:48 PM

    doesn't look like it's protecting against nsnull values