Skip to content Skip to sidebar Skip to footer

Check If Any Value In Jsonpath Is Repeated

I have a jsonPath as below { 'book': [ { 'category': 'reference', 'author': 'Nigel Rees', 'title': 'Sayings of the Century',

Solution 1:

Depends what you are planning on doing if the authors names exists. If you only want the objects with author of Nigel Reese you could use a filter.

var booksByNigelReese = book.filter( function(book, index) {
        return book.author === 'Nigel Reese'
    })

.filter() takes a function that takes the book and index, chooes to accept or rejcet the book into a new array depending if the result of the function is true or false

Post a Comment for "Check If Any Value In Jsonpath Is Repeated"