### 1、JsonPath 应用参考



| 应用接口   | 描述 | 备注 |
| -------- | -------- | -------- |
| `ONode:select(...) -> ONode`      | 查找     |       |
| `ONode:exists(...) -> bool`           | 包括     |       |
| `ONode:delete(...)`                      | 删除     |       |
| `ONode:create(...)`                      | 创建     | 表达式不能有 `...x` 或 `*` 片段（因为自己是空，没法展开）     |




应用示例

```java
ONode oNode = ONode.ofBean(store);

oNode.select("$..book[?@.tags contains 'war'].first()").toBean(Book.class); //RFC9535 规范，可以没有括号
oNode.select("$..book[?(!(@.category == 'fiction') && @.price < 40)].first()").toBean(Book.class);
oNode.select("$.store.book.count()");

ONode.ofJson(store).create("$.store.book[0].category").toJson();

ONode.ofBean(store).delete("$..book[-1]");
```





### 2、表达式示例与说明

样本数据

```json
{ "store": {
    "book": [
      { "category": "reference",
        "author": "Nigel Rees",
        "title": "Sayings of the Century",
        "price": 8.95
      },
      { "category": "fiction",
        "author": "Evelyn Waugh",
        "title": "Sword of Honour",
        "price": 12.99
      },
      { "category": "fiction",
        "author": "Herman Melville",
        "title": "Moby Dick",
        "isbn": "0-553-21311-3",
        "price": 8.99
      },
      { "category": "fiction",
        "author": "J. R. R. Tolkien",
        "title": "The Lord of the Rings",
        "isbn": "0-395-19395-8",
        "price": 22.99
      }
    ],
    "bicycle": {
      "color": "red",
      "price": 399
    }
  }
}
```


示例JSONPath表达式及其应用于示例JSON值时的预期结果

| JSONPath                         | 预期结果                   | 
|----------------------------------|------------------------|
| `$.store.book[*].author`         | 书店里所有书的作者              | 
| `$..autho`                       | 所有作者                   | 
| `$.store.*`                      | 商店里的所有东西，包括一些书和一辆红色的自行车 | 
| `$.store..price`                 | 商店里所有东西的价格             | 
| `$..book[2]`                     | 第三本书                   | 
| `$..book[2].author`              | 第三本书的作者                | 
| `$..book[2].publisher`           | 空结果：第三本书没有“publisher”成员 | 
| `$..book[-1]`                    | 最后一本书                  | 
| `$..book[0,1]`<br/>`$..book[:2]` | 前两本书                   | 
| `$..book[?@.isbn]`               | 所有有国际标准书号的书            | 
| `$..book[?@.price<10]`           | 所有比10便宜的书              | 
| `$..*`                           | 输入值中包含的所有成员值和数组元素      | 


