Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected empty array returned on expression rather than NULL #66

Open
richardgaunt opened this issue Nov 10, 2020 · 0 comments
Open

Comments

@richardgaunt
Copy link

I just wanted to confirm / point out that I am receiving back a value from the below method that is different from the code comments:

\JmesPath\Env::search($expression, $data);

https://github.com/jmespath/jmespath.php/blob/master/src/Env.php#L25

The document block states that I should @return mixed Returns the matching data or null receive matching data or null but I have found that when I utilise this with object or list projection like:

included[?type=='paragraph--basic_text'] as long as the included array exists in the JSON, it will return an empty array rather than a NULL value.

Can I confirm that this is the expected behaviour?

Checking the tutorial website I get the same result in different versions of jmespath.

Thank you very much for the package. I am utilising it in integration testing to evaluate json responses which is incredibly useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant