Skip to content
A high performance JSON library in Swift
Branch: master
Clone or download
Latest commit ec6aa08 May 1, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
Sources/IkigaJSON Another round of trying to improve Linux Swift 5 support Apr 28, 2019
Tests Small cleanups Apr 25, 2019
.gitignore Initial commit Nov 10, 2018
IkigaJSON.podspec Update cocoapods Apr 27, 2019
LICENSE Create LICENSE Nov 24, 2018
Package.swift Move all internals to NIO Jan 20, 2019 Update May 1, 2019


IkigaJSON is a really fast JSON parser. It performed ~4x faster than Foundation in our tests when decoding a type from JSON.

Adding the dependency

The 1.x versions are reliant on SwiftNIO 1.x, and for SwiftNIO 2.x support use the 2.x versions of IkigaJSON.


.package(url: "", from: "1.0.0"),
// Or, for SwiftNIO 2
.package(url: "", from: "2.0.0"),


pod 'IkigaJSON', '~> 1.0'
# Or, for SwiftNIO 2
pod 'IkigaJSON', '~> 1.0'


import IkigaJSON

struct User: Codable {
    let id: Int
    let name: String

let data = Data()
var decoder = IkigaJSONDecoder()
let user = try decoder.decode(User.self, from: data)


IkigaJSON supports raw JSON types (JSONObject and JSONArray) like many other libraries do, alongside the codable API described above. The critical difference is that IkigaJSON edits the JSON inline, so there's no additional conversion overhead from Swift type to JSON.

var user = JSONObject()
user["username"] = "Joannis"
user["roles"] = ["admin", "moderator", "user"] as JSONArray
user["programmer"] = true


// OR
print(user["username"] as? String)

SwiftNIO support

The encoders and decoders support SwiftNIO.

var user = try JSONObject(buffer: byteBuffer)

We also have added the ability to use the IkigaJSONEncoder and IkigaJSONDecoder with JSON.

let user = try decoder.decode([User].self, from: byteBuffer)
var buffer: ByteBuffer = ...

try encoder.encodeAndWrite(user, into: &buffer)

The above method can be used to stream multiple entities from a source like a database over the socket asynchronously. This can greatly reduce memory usage.


By design you can build on top of any data storage as long as it exposes a pointer API. This way, IkigaJSON doesn't (need to) copy any data from your buffer keeping it lightweight. The entire parser can function with only 1 memory allocation and allows for reusing the Decoder to reuse the memory allocation.


  • All decoding strategies that Foundation supports
  • Unicode
  • Codable
  • Escaping
  • Performance 🚀
  • Date/Data encoding strategies
  • Raw JSON APIs (non-codable)
  • Codable decoding from JSONObject and JSONArray
  • \u escaped unicode characters


  • Lightweight JSON inline comparison helpers



You can’t perform that action at this time.