Skip to content

isExists() returns true when no JSON present #498

@slhodson969

Description

@slhodson969

I seem to be experiencing an issue that if there is no JSON and I try to check if a key exists in the JSON, it returns true. Below is a code example from one of my alamofire network calls that returns a 204 no content

case .Success:
    if let value = response.result.value {
        let json = JSON(value)

        if json["scott"].isExists() {
            print("FOUND YOU SCOTT 👋🏽👋🏽👋🏽👋🏽👋🏽👋🏽👋🏽")
        }
    }
}

I can handle this in my code but it seems like bug to me if isExists() returns true when no JSON even exists, let alone the key you are checking for.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions