Filter Beispiele JSON Datenquelle

Quelle: jsonpath-examples-expression-cheetsheet

//get all books for store

$.store.books[*]

                     

//get all sections from all books

$.store.books[*].sections[*]     

 

//get all authors of all books for store

$.store.books[*].author  

             

//get 3rd book record 

$.store.books[2]    

 

//get first 2 books from the top

$.store.books[:2]   

 

//get last 2 books

$.store.books[-2:]

  

//get all books where author attribute equals to ‘sam’

$.store.books[?(@author==’Nigel Rees’)] 

 

//get all documents / sub documents (any level) where author attribute equals to ‘sam’

$..[?(@author==’Nigel Rees’)] 

 

//get books where price is less than 10

$.store.books[?(@.price<10)] 

 

//filter all books with tag

$.store.books[?(@.tag)]

 

//find all books which contains section s1 or s2 (Use of Logical operator OR ( || )

$.store.books[?(@.sections[*]==’s1′ || @.sections[*]==’s2′ )]

 

//find all books where first section is s1 and second section is s2 (Logical operator OR ( && )

$.store.books[?(@.sections[0]==’s1′ && @.sections[1]==’s2′ )]

//Using Regular Expression: get all books where author attribute contains ‘Nigel’ or ‘Waugh’

//Learn more about regular expressions here : https://zappysys.com/blog/using-regular-expressions-in-ssis/

$.store.books[?(@author=~ /Nigel|Waugh/  )] 

 

//Using Regular Expression: get all books where category is ‘reference’ OR author attribute contains ‘Nigel’ or ‘Waugh’

$.store.books[?(@category==’reference’ || @author=~ /Nigel|Waugh/ )] 

 

//Using Regular Expression: get all books where category is ‘reference’ AND author attribute contains ‘Nigel’ or ‘Waugh’

$.store.books[?(@category==’reference’ && @author=~ /Nigel|Waugh/ )] 

 

//Using Regular Expression: get all books where author name either start with ‘Nigel’ (see ^ prefix) or ends with ‘Waugh’ (see $ suffix)

//Learn more about regular expressions here : https://zappysys.com/blog/using-regular-expressions-in-ssis/

$.store.books[?(@author=~ /^Nigel|Waugh$/  )] 

 

//Using Regular Expression: get all books where author name starts with ‘Nigel’

//Learn more about regular expressions here : https://zappysys.com/blog/using-regular-expressions-in-ssis/

$.store.books[?(@author=~ /^Nigel/  )] 

 

//Using Regular Expression: get all books where author name ends with ‘Waugh’

//Learn more about regular expressions here : https://zappysys.com/blog/using-regular-expressions-in-ssis/

$.store.books[?(@author=~ /Waugh$/  )] 

7 Kommentare

Trackbacks & Pingbacks

  1. obat xenical review

    obat xenical review

  2. tadalafil vs viagra

    tadalafil vs viagra

  3. esomeprazole 20mg powder

    esomeprazole 20mg powder

  4. lasix medicine for fluid

    lasix medicine for fluid

  5. buy zithromax antibiotic

    buy zithromax antibiotic

  6. remeron weight gain

    remeron weight gain

Hinterlasse einen Kommentar

An der Diskussion beteiligen?
Hinterlasse uns deinen Kommentar!

Schreibe einen Kommentar