         return try getter(json)
     }
     
-    private func fetchNullableValueAtPath<Value>(first: PathFragment?, _ rest: [PathFragment], detectNull: Swift.Bool = false, @noescape getter: JSON throws -> Value) throws -> Value? {
-        let json = try valueAtPath(first, rest, detectNull: detectNull)
-        do {
-            return try getter(json)
-        } catch Error.ValueNotConvertible where json == .Null {
-            return nil
-        }
-    }
-    
     private func decodedAtPath<Decoded: JSONDecodable>(first: PathFragment?, _ rest: [PathFragment]) throws -> Decoded {
         return try fetchValueAtPath(first, rest) { try $0.decode() }
     }

//

// MARK: - Subscripting

extension JSON {
    

    // MARK: Simple optional unpacking
    
    private func optionalAtPath<Value>(first: PathFragment?, _ rest: [PathFragment], ifNotFound: Swift.Bool, ifNull: Swift.Bool, @noescape getter: JSON throws -> Value) throws -> Value? {
        var json: JSON?
        do {
            json = try valueAtPath(first, rest, detectNull: true)
            return try getter(unsafeUnwrap(json))
        } catch Error.IndexOutOfBounds where ifNotFound {
            return nil
        } catch Error.KeyNotFound where ifNotFound {
            return nil
        } catch Error.UnexpectedSubscript(let type) where ifNotFound && type == Swift.String.self {
            return nil
        } catch Error.ValueNotConvertible where ifNull && json == .Null {
            return nil
        }  catch SubscriptError.SubscriptIntoNull where ifNull {
            return nil
        } catch SubscriptError.SubscriptIntoNull(.Key) where ifNotFound {
            return nil
        } catch SubscriptError.SubscriptIntoNull(let fragment) {
            throw Error.UnexpectedSubscript(type: fragment.valueType)
        }
    }
    
