0

I want to filter collection of Java DTO Objects using JsonPath library. I have List<AuthorGetDto> with some objects and I want to do something like this:

List<AuthorGetDto> authors = authorService.getAllAuthors();
List<AthorGetDto> filtered = JsonPath.read(authors, "$.[?(@.authorId=='985')]");

Is it possible to do something like this? Or I must firstly parse this objects to String than filter them using JsonPath, and after that convert them to List<AuthorGetDto>?

user1803551
  • 12,965
  • 5
  • 47
  • 74
Roman Shmandrovskyi
  • 883
  • 2
  • 8
  • 22
  • Post a [mcve], including the relevant definitions of `AuthorGetDto`, `authorService` and `JsonPath`. – user1803551 Apr 11 '19 at 11:27
  • 1
    No, JsonPath is for querying json. Java objects are not json. https://stackoverflow.com/questions/1217228/what-is-the-java-equivalent-for-linq – tom redfern Apr 11 '19 at 15:11

0 Answers0