JMESPath Contributions

Community contributed extensions to JMESPath for Java

License

License

GroupId

GroupId

io.burt
ArtifactId

ArtifactId

jmespath-contrib
Last Version

Last Version

0.4.0
Release Date

Release Date

Type

Type

jar
Description

Description

JMESPath Contributions
Community contributed extensions to JMESPath for Java
Source Code Management

Source Code Management

https://github.com/burtcorp/jmespath-java-contrib.git

Download jmespath-contrib

How to add to project

<!-- https://jarcasting.com/artifacts/io.burt/jmespath-contrib/ -->
<dependency>
    <groupId>io.burt</groupId>
    <artifactId>jmespath-contrib</artifactId>
    <version>0.4.0</version>
</dependency>
// https://jarcasting.com/artifacts/io.burt/jmespath-contrib/
implementation 'io.burt:jmespath-contrib:0.4.0'
// https://jarcasting.com/artifacts/io.burt/jmespath-contrib/
implementation ("io.burt:jmespath-contrib:0.4.0")
'io.burt:jmespath-contrib:jar:0.4.0'
<dependency org="io.burt" name="jmespath-contrib" rev="0.4.0">
  <artifact name="jmespath-contrib" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.burt', module='jmespath-contrib', version='0.4.0')
)
libraryDependencies += "io.burt" % "jmespath-contrib" % "0.4.0"
[io.burt/jmespath-contrib "0.4.0"]

Dependencies

compile (1)

Group / Artifact Type Version
io.burt : jmespath-core jar 0.3.0

test (4)

Group / Artifact Type Version
io.burt : jmespath-jackson jar 0.3.0
io.burt : jmespath-gson jar 0.3.0
junit : junit jar 4.12
org.hamcrest : hamcrest-library jar 1.3

Project Modules

There are no modules declared in this project.

jmespath-java-contrib

Build Status

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).

This is a companion library to jmespath-java with functions and other features not in the JMESPath specification.

Installation

Using Maven you can add this to your dependencies:

<dependency>
  <groupId>io.burt</groupId>
  <artifactId>jmespath-contrib</artifactId>
  <version>${jmespath.version}</version>
</dependency>

Check the releases page for the value of ${jmespath.version}.

Usage

The functions can be found in the io.burt.jmespath.contrib package. To use contributed functions you create a FunctionRegistry, register the functions you want to use, create a runtime configuration with the registry, and create a runtime with that configuration:

import com.fasterxml.jackson.databind.JsonNode;

import io.burt.jmespath.JmesPath;
import io.burt.jmespath.function.FunctionRegistry;
import io.burt.jmespath.contrib.function.LowerCaseFunction;
import io.burt.jmespath.contrib.function.UpperCaseFunction;
import io.burt.jmespath.contrib.function.ConcatFunction;
import io.burt.jmespath.jackson.JacksonRuntime;

// There's a default registry that contains the built in JMESPath functions
FunctionRegistry defaultFunctions = FunctionRegistry.defaultRegistry();
// And we can create a new registry with additional functions by extending it
FunctionRegistry customFunctions = defaultFunctions.extend(new LowerCaseFunction(),
                                                           new UpperCaseFunction(),
                                                           new ConcatFunction());
// To configure the runtime with the registry we need to create a configuration
RuntimeConfiguration configuration = new RuntimeConfiguration.Builder()
                                       .withFunctionRegistry(customFunctions)
                                       .build();
// And then create a runtime with the configuration
JmesPath<JsonNode> runtime = new JacksonRuntime(configuration);
// Now the functions are available in expressions
JsonNode result = runtime.compile("concat(lower_case(first_name), ' ', upper_case(last_name))").search(input);

How to build and run the tests

$ mvn test

And all dependencies should be installed, the code compiled and the tests run.

Copyright

© 2016-2018 Burt AB and contributors, see LICENSE.txt (BSD 3-Clause).

io.burt

Burt

Versions

Version
0.4.0
0.3.0