-
Notifications
You must be signed in to change notification settings - Fork 40
Open
Description
I did a bit of experimentation with a PR but wasn't quite able to get it to work, so I thought I'd take this to an issue to look for some ideas on how to implement :)
Given the sample document, I'm interested in being able to use remove()
without providing a field, e.g. removing all matching paths.
Essentially supporting something like this:
$jsonObject = new JsonObject($json);
$jsonObject->remove("$..book[?(@.category == 'fiction')]");
$results = $jsonObject->toValue();
// $results with all fiction books removed.
I tried a simple unset($element);
in the remove
code but PHP's unset only unsets the reference, not the original value, so it doesn't quite work.
jawira
Metadata
Metadata
Assignees
Labels
No labels