| 36 | } |
| 37 | |
| 38 | void jmespath_expression_example() |
| 39 | { |
| 40 | std::string jtext = R"( |
| 41 | { |
| 42 | "people": [ |
| 43 | { |
| 44 | "age": 20, |
| 45 | "other": "foo", |
| 46 | "name": "Bob" |
| 47 | }, |
| 48 | { |
| 49 | "age": 25, |
| 50 | "other": "bar", |
| 51 | "name": "Fred" |
| 52 | }, |
| 53 | { |
| 54 | "age": 30, |
| 55 | "other": "baz", |
| 56 | "name": "George" |
| 57 | } |
| 58 | ] |
| 59 | } |
| 60 | )"; |
| 61 | |
| 62 | auto expr = jmespath::make_expression<json>("people[?age > `20`].[name, age]"); |
| 63 | |
| 64 | json doc = json::parse(jtext); |
| 65 | |
| 66 | json result = expr.evaluate(doc); |
| 67 | |
| 68 | std::cout << pretty_print(result) << "\n\n"; |
| 69 | } |
| 70 | |
| 71 | void let_example() |
| 72 | { |
no test coverage detected