Latest 1.0.0
License MIT
Platforms ios 8.0, osx 10.9, watchos 2.0, tvos 9.0
Frameworks Foundation

Build Status



Add the line pod "Bourne" to your Podfile


Add the line github "nanoxd/Bourne" to your Cartfile


Clone the repo and drag the file Bourne.swift into your Xcode project.

Swift Package Manager

Add the line .Package(url: "", majorVersion: 1) to your Package.swift file.


Conforming to Mappable

import Bourne

struct Person {
  let firstName: String
  let lastName: String
  let age: Int?

extension Person: Mappable {
  static func decode(_ j: JSON) throws -> Person {
    return Person(
      firstName: try j.from("firstName"),
      lastName: try j.from("lastName", or: "Medina"),
      age: try? j.from("age")

Optional Values

Bourne has two ways of working with Optional values, try? and adding a default value to from.

First, let’s look at how to decode a value that is sometimes included in our JSON:

  "people": [
      "firstName": "Jose",
      "lastName": null
      "firstName": "Maria",
      "lastName": "Sanchez",
      "age": 20
try? j.from("age")

Latest podspec

    "name": "Bourne",
    "version": "1.0.0",
    "summary": "A JSON parser",
    "description": "A faster JSON parser.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Fernando Paredes": "[email protected]"
    "social_media_url": "",
    "platforms": {
        "ios": "8.0",
        "osx": "10.9",
        "watchos": "2.0",
        "tvos": "9.0"
    "source": {
        "git": "",
        "tag": "1.0.0"
    "source_files": "Sources/**/*",
    "frameworks": "Foundation",
    "pushed_with_swift_version": "3.1"

Pin It on Pinterest

Share This