You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 31, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
5
5
_If you're reading this on GitHub, please note that this is the readme for the development version and that some features described here might not yet have been released. You can find the readme for a specific version via the release tags ([here is an example](https://github.com/burtcorp/jmespath-java/releases/tag/jmespath-0.1.0))._
6
6
7
-
An implementation of [JMESPath](http://jmespath.org/) for Java. It supports searching JSON documents (via Jackson) and structures containing basic Java objects (`Map`, `List`, `String`, etc.) – but can also be extended to work with any JSON-like structure.
7
+
This is an implementation of [JMESPath](http://jmespath.org/) for Java and it supports searching JSON documents (via Jackson) and structures containing basic Java objects (`Map`, `List`, `String`, etc.) – but can also be extended to work with any JSON-like structure.
8
8
9
9
## Installation
10
10
@@ -24,9 +24,9 @@ If you don't want the Jackson implementation you can change the `artifactId` to
24
24
25
25
### Dependencies
26
26
27
-
`jmespath-core` has an ANTLR based parser, but the ANTLR runtime artifact has been shaded into the `io.burt.jmespath` package to avoid conflicts with other artifacts that may depend on ANTLR.
27
+
`jmespath-core` has an ANTLR based parser, but the ANTLR runtime artifact has been shaded into the `io.burt.jmespath` package to avoid conflicts with other artifacts that may depend on ANTLR. This means that `jmespath-core` has external dependencies.
28
28
29
-
`jmespath-jackson` obviously depends on Jackson, specifically Jackson DataBind (`com.fasterxml.jackson.core:jackson-databind`).
29
+
`jmespath-jackson` obviously depends on Jackson, specifically Jackson DataBind (`com.fasterxml.jackson.core:jackson-databind`), but other than that it only depends on `jmespath-core`.
30
30
31
31
## Basic usage
32
32
@@ -65,7 +65,7 @@ JsonNode result = expression.search(input);
65
65
66
66
### Adding custom functions
67
67
68
-
In addition to the built in functions like `sort`, `to_string`, and `sum` you can add your own. All you need to do is to create a class that extends `io.burt.jmespath.function.BaseFunction` (actually implement `Function`in the same package, but then you'd need to do much more work yourself) and then register it with your runtime.
68
+
In addition to the built in functions like `sort`, `to_string`, and `sum` you can add your own. All you need to do is to create a class that extends `io.burt.jmespath.function.BaseFunction` (actually implement `Function`from the same package, but then you'd need to do much more work yourself) and then register it with your runtime.
JsonNode result = runtime.compile("sin(measurements.angle)").search(input);
@@ -134,7 +134,7 @@ Creating a runtime adapter is a bit more work than adding a function, but not ex
134
134
135
135
Most of the work a runtime does is converting back and forth between Java types. The core runtime can't know about all of the types of structures you want to search, but it knows that they will be JSON-like, so it uses the runtime adapters to help translate. The Jackson runtime adapter, for example, translates the world of `JsonNode`s into Java types like `List` and `String` when asked by the core runtime.
136
136
137
-
Runtime adapters can wrap libraries like [Gson](https://github.com/google/gson), but can also make it possibleto search Java beans with JMESPath. A runtime adapter could translate "get property X" to a `getX()` method call via reflection, for example. The structure to search doesn't have to be JSON, it just has to be JSON-_like_.
137
+
Runtime adapters can wrap libraries like [Gson](https://github.com/google/gson), but can also make it possible, for example, to search Java beans with JMESPath by translating JMESPath operations to reflection calls. The structure to search doesn't have to be JSON, it just has to be JSON-_like_.
138
138
139
139
A good starting point for writing a new runtime adapter is reading the code of the existing adapters and the docs for `Adapter` and `BaseAdapter`. There are also JUnit tests in `JmesPathRuntimeTest` and `JmesPathComplianceTest` that can be subclassed and run against any runtime.
140
140
@@ -151,4 +151,4 @@ And all dependencies should be installed, the code compiled and the tests run.
0 commit comments