Skip to content

Commit

Permalink
fix(json): select none correctly selects flat items
Browse files Browse the repository at this point in the history
  • Loading branch information
EdJoPaTo committed May 13, 2024
1 parent 2a4f135 commit 5a8268d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ fn select_one<'value>(root: &'value Value, selector: &Selector) -> Option<&'valu
match (root, selector) {
(Value::Object(object), Selector::ObjectKey(key)) => object.get(key),
(Value::Array(array), Selector::ArrayIndex(index)) => array.get(*index),
(Value::Bool(_) | Value::Null | Value::Number(_) | Value::String(_), Selector::None) => Some(root),
_ => None,
}
}
Expand Down

0 comments on commit 5a8268d

Please sign in to comment.