Expression JPath

Filtre champs, nœuds ou résultats de documents structurés avec une requête.

Entrée: TexteRésultat: Texte

Saisie de texte

Options

Exemples

All data in object

Entrée

{"store":{"book":[{"category":"reference","author":"Nigel Rees","title":"Sayings of the Century","price":8.95},{"category":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99},{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99},{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99}],"bicycle":{"color":"red","price":19.95},"newspaper":[{"format":"broadsheet","title":"Financial Times","price":2.75},{"format":"tabloid","title":"The Guardian","price":2}]}}

Expected answer

[{"category":"reference","author":"Nigel Rees","title":"Sayings of the Century","price":8.95},{"category":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99},{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99},{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99}]
{"color":"red","price":19.95}
[{"format":"broadsheet","title":"Financial Times","price":2.75},{"format":"tabloid","title":"The Guardian","price":2}]
Requête
$.store.*
Délimiteur de résultat
All elements in array which meet condition

Entrée

{"store":{"book":[{"category":"reference","author":"Nigel Rees","title":"Sayings of the Century","price":8.95},{"category":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99},{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99},{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99}],"bicycle":{"color":"red","price":19.95},"newspaper":[{"format":"broadsheet","title":"Financial Times","price":2.75},{"format":"tabloid","title":"The Guardian","price":2}]}}

Expected answer

{"category":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99}
{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99}
{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99}
Requête
$..book[?(@.price<30 && @.category=="fiction")]
Délimiteur de résultat
All elements in array with property

Entrée

{"store":{"book":[{"category":"reference","author":"Nigel Rees","title":"Sayings of the Century","price":8.95},{"category":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99},{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99},{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99}],"bicycle":{"color":"red","price":19.95},"newspaper":[{"format":"broadsheet","title":"Financial Times","price":2.75},{"format":"tabloid","title":"The Guardian","price":2}]}}

Expected answer

{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99}
{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99}
Requête
$..book[?(@.isbn)]
Délimiteur de résultat
All elements in object

Entrée

{"store":{"book":[{"category":"reference","author":"Nigel Rees","title":"Sayings of the Century","price":8.95},{"category":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99},{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99},{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99}],"bicycle":{"color":"red","price":19.95},"newspaper":[{"format":"broadsheet","title":"Financial Times","price":2.75},{"format":"tabloid","title":"The Guardian","price":2}]}}

Expected answer

{"category":"reference","author":"Nigel Rees","title":"Sayings of the Century","price":8.95}
{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99}
Requête
$..book[?(@.price<10)]
Délimiteur de résultat
Empty expression

Entrée

{"store":{"book":[{"category":"reference","author":"Nigel Rees","title":"Sayings of the Century","price":8.95},{"category":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99},{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99},{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99}],"bicycle":{"color":"red","price":19.95},"newspaper":[{"format":"broadsheet","title":"Financial Times","price":2.75},{"format":"tabloid","title":"The Guardian","price":2}]}}

Expected answer

Empty result
Requête
(empty)
Délimiteur de résultat
Fetch of all values with matching key

Entrée

{"store":{"book":[{"category":"reference","author":"Nigel Rees","title":"Sayings of the Century","price":8.95},{"category":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99},{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99},{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99}],"bicycle":{"color":"red","price":19.95},"newspaper":[{"format":"broadsheet","title":"Financial Times","price":2.75},{"format":"tabloid","title":"The Guardian","price":2}]}}

Expected answer

"Sayings of the Century"
"Sword of Honour"
"Moby Dick"
"The Lord of the Rings"
"Financial Times"
"The Guardian"
Requête
$..title
Délimiteur de résultat
Fetch of values from specific object

Entrée

{"store":{"book":[{"category":"reference","author":"Nigel Rees","title":"Sayings of the Century","price":8.95},{"category":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99},{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99},{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99}],"bicycle":{"color":"red","price":19.95},"newspaper":[{"format":"broadsheet","title":"Financial Times","price":2.75},{"format":"tabloid","title":"The Guardian","price":2}]}}

Expected answer

"Nigel Rees"
"Evelyn Waugh"
"Herman Melville"
"J. R. R. Tolkien"
Requête
$.store.book[*].author
Délimiteur de résultat
First 2 elements in array

Entrée

{"store":{"book":[{"category":"reference","author":"Nigel Rees","title":"Sayings of the Century","price":8.95},{"category":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99},{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99},{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99}],"bicycle":{"color":"red","price":19.95},"newspaper":[{"format":"broadsheet","title":"Financial Times","price":2.75},{"format":"tabloid","title":"The Guardian","price":2}]}}

Expected answer

{"category":"reference","author":"Nigel Rees","title":"Sayings of the Century","price":8.95}
{"category":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99}
Requête
$..book[:2]
Délimiteur de résultat
Last element in array

Entrée

{"store":{"book":[{"category":"reference","author":"Nigel Rees","title":"Sayings of the Century","price":8.95},{"category":"fiction","author":"Evelyn Waugh","title":"Sword of Honour","price":12.99},{"category":"fiction","author":"Herman Melville","title":"Moby Dick","isbn":"0-553-21311-3","price":8.99},{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99}],"bicycle":{"color":"red","price":19.95},"newspaper":[{"format":"broadsheet","title":"Financial Times","price":2.75},{"format":"tabloid","title":"The Guardian","price":2}]}}

Expected answer

JSON
{"category":"fiction","author":"J. R. R. Tolkien","title":"The Lord of the Rings","isbn":"0-395-19395-8","price":22.99}
Requête
$..book[-1:]
Délimiteur de résultat
Empty JSON

Entrée

Expected rejection

Message contains
Invalid input JSON:
Requête
(empty)
Délimiteur de résultat

Paramètres

ParamètreValeur par défautEntrée et choix
Requête""Texte
Délimiteur de résultat"\\n"Les séquences d’échappement comme \n, \r et \t sont acceptées

Outils associés

Extraction

Référence de l’opération

Voir la documentation technique originale (English)