In the standard library source code base to make changes to solve the various JSONDecoder parsing failure problems, such as the key value does not exist, the value is null, the type is inconsistent.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

  • IOS 9.0 +
  • Swift 4

Installation

CleanJSON is available through CocoaPods or Carthage. To install it, simply add the following line to your Podfile or Cartfile:

Podfile

pod 'CleanJSON'Copy the code

Cartfile

github "Pircate/CleanJSON"Copy the code

Import

import CleanJSONCopy the code

Usage

let decoder = CleanJSONDecoder()
try decoder.decode(Model.self, from: data)Copy the code

Author

Pircate, [email protected]

License

CleanJSON is available under the MIT license. See the LICENSE file for more info.