     }
     return castedValue
 }
-
-private func castNotBooleanNumber(_ value: Any) throws -> NSNumber {
-    guard let number = value as? NSNumber, number !== kCFBooleanTrue && number !== kCFBooleanFalse else {
-        throw JSON.Error.typeMismatch(expected: NSNumber.self, actualValue: value, path: [])
-    }
-    
-    return number
-}

import class Foundation.NSNumber
import struct Foundation.Decimal
import let Foundation.kCFBooleanTrue
import let Foundation.kCFBooleanFalse

public protocol Parsable {
    static func value(from json: JSON) throws -> Self

    }
}

extension Bool: Parsable {
    public static func value(from json: JSON) throws -> Bool {
        return try cast(json.rawValue)
    }
}

extension NSNumber: Parsable {
    public static func value(from json: JSON) throws -> Self {
        return try cast(json.rawValue)
    }
}

extension Double: Parsable {
    public static func value(from json: JSON) throws -> Double {
        return try NSNumber.value(from: json).doubleValue
    }
}

extension Float: Parsable {
    public static func value(from json: JSON) throws -> Float {
        let number = try NSNumber.value(from: json)
        let double = number.doubleValue
        guard Swift.abs(double) <= Double(Float.greatestFiniteMagnitude)
            else { throw JSON.Error.dataCorrupted(value: number, description: "The parsed number(\(number) does overflow in Float type.") }
