How to easily parse deep json in Swift
Issue #414
Codable
is awesome, but sometimes we just need to quickly get value in a deepy nested JSON. In the same way I did for Dart How to resolve deep json object in Dart, let’s make that in Swift.
See https://github.com/onmyway133/Omnia/blob/master/Sources/Shared/JSON.swift
1 | public func resolve<T>(_ jsonDictionary: [String: Any], keyPath: String) -> T? { |
So we can just resolve via key path
1 | class JSONTests: XCTestCase { |