com.jayway.jsonpath.Filter Java Examples

The following examples show how to use com.jayway.jsonpath.Filter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JsonPathExample.java    From levelup-java-examples with Apache License 2.0 6 votes vote down vote up
/**
 * Issues that are open and have a number >= 30
 */
@Test
public void issues_by_state_and_number () {
	
	Filter<?> filter = Filter.filter(
			Criteria.where("state")
				.is("open")
				.and("number")
				.gte(30));

	List<Object> issuesByLabelAndAuthor = JsonPath.read(githubIssues, "$.[?]", filter);
	
	logger.info(issuesByLabelAndAuthor);

	assertEquals(1, issuesByLabelAndAuthor.size());
}
 
Example #2
Source File: JsonPathExpressionValidator.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
public PathToken analyzeCriteriaSequence4() {
    int[] bounds = findFilterBounds();
    if (bounds == null) {
        return null;
    }
    i = bounds[1];

    return new PredicatePathToken(Filter.parse(pathFragment.substring(bounds[0], bounds[1])));
}
 
Example #3
Source File: OperationIntegrationTest.java    From tutorials with MIT License 5 votes vote down vote up
@Test
public void givenJsonPathWithFilterPredicate_whenReading_thenCorrect() {
    Filter expensiveFilter = Filter.filter(Criteria.where("price")
        .gt(20.00));
    List<Map<String, Object>> expensive = JsonPath.parse(jsonDataSourceString)
        .read("$['book'][?]", expensiveFilter);
    predicateUsageAssertionHelper(expensive);
}
 
Example #4
Source File: JsonPathSelector.java    From camunda-bpm-reactor with Apache License 2.0 4 votes vote down vote up
public JsonPathSelector(ObjectMapper mapper, String jsonPath, Filter... filters) {
  super(JsonPath.compile(jsonPath, filters));
  this.mapper = mapper;
  this.jsonPathConfig = Configuration.builder().jsonProvider(new Jackson2JsonProvider(mapper)).build();
}
 
Example #5
Source File: JsonPathSelector.java    From camunda-bpm-reactor with Apache License 2.0 4 votes vote down vote up
public JsonPathSelector(String jsonPath, Filter... filters) {
  this(MAPPER, jsonPath, filters);
}
 
Example #6
Source File: JsonPathSelector.java    From camunda-bpm-reactor with Apache License 2.0 4 votes vote down vote up
public static Selector J(String jsonPath, Filter... filters) {
  return jsonPathSelector(jsonPath, filters);
}
 
Example #7
Source File: JsonPathSelector.java    From camunda-bpm-reactor with Apache License 2.0 4 votes vote down vote up
public static Selector jsonPathSelector(String jsonPath, Filter... filters) {
  return new JsonPathSelector(jsonPath, filters);
}