Serpent - more than just another JSON mapping framework

At Nodes, we develop apps that rely a lot on complex REST APIs. The iOS team needed a fast and fully featured JSON mapping framework.
We had been using our own internal parsing framework for Objective-C for a long time, but when Swift came out we decided to create a new one, in Swift, taking advantage of protocol-oriented programming.

After many iterations and a renaming (our JSON mapping framework was previously known as Serializable), we are proud to announce that Serpent has reached version 1.0.

Another JSON mapping framework?

More than that. Serpent is one of the fastest JSON mappers out there and has the most features, according to our analysis.

And maybe you only have to parse and map small JSONs, and you don’t care that much about the time it takes. But what about the time it takes to write the mapping code?

We made a tool that goes hand in hand with Serpent: with Model Boiler you only have to declare the properties on your model, and the parsing code will be generated for you, potentially saving you hours of work.

But why build a new one?

Yes, there are lots of other JSON mapping frameworks out there. But when we started developing Serpent, there was only SwiftyJSON, which wasn’t exactly what we wanted. So we needed to build our own.

In February 2016, we moved the project to a public GitHub repo and began developing in the open. At the same time, we started using this framework in all our apps, and at the moment, we can say that Serpent is used in apps with more than 1.3 million monthly users.

Working with Serpent

We built Serpent to make developers’ life as easy as possible when creating models. So we also built a few goodies around Serpent, which allow the developer to save a lot of time when creating the models for the app.

Serpent Xcode File Template

We made the Serpent Xcode File Template, which adds a new file template for Xcode. No more typing import Serpent manually. It sounds small, but when you have to create 10-20 models, it saves you from a lot of annoyance.

Model Boiler

The most annoying part when working with JSONs in Swift is typing all the parsing code. We made a tool that works with Serpent that does that for you. The Model Boiler is a small macOS app that lives in your mac’s menu bar. In Xcode (or your favourite editor), select the code for the model and its properties, and press a keyboard shortcut, and the Model Boiler will generate the necessary code for parsing to your Clipboard. You can just paste the parsing code in your model. And that’s it.

Together with the Xcode file template and with the Model Boiler, Serpent is (in our opinion) the easiest and most pleasant to use JSON mapping framework for Swift.

Why Serpent?

Here’s a short list of some of the advantages that Serpent has:

  • Its own Xcode file template
  • Its own code generator: Model Boiler
  • The best balance between speed and features. We did the tests and we compared it to some of the most popular JSON mapping frameworks out there.
  • 100% test coverage
  • Carthage, CocoaPods and Swift Package Manager support
  • Different versions of it are used in apps used by more than 1.3 million users every month (based on analytics data for some of our apps).

We’re really proud to be able to release the 1.0 version of Serpent. The biggest thanks go to all the contributors that made it possible. We hope more developers find Serpent useful and give it a try in their apps.

Serpent is open source. If you find bugs or have ideas for new features, you’re more than welcome to contribute to Serpent. And if you really like what we’re doing, check out the Nodes careers page and join us to make awesome things together.

This page was updated, please reload to see the changes
This site is now available offline