Skip to content

Custom "None" value when search fails #186

Description

@fjsj

Hi, thanks for this awesome lib!
One question: it seems to be impossible to set a custom return in case the search fails.

E.g.

not_found = object()
jmespath.search('foo.aaa', {'foo': {'bar': 'baz'}})  # I need `not_found`, not `None`

Is this by design or are you open to supporting that?
I see this was discussed at #113
But the proposed solution of contains isn't great, as it requires 2 searches.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions