Extract values from JSON data using JSONPath or object-path syntaxes in an online editor and view the results in real-time
Supports both JSONPath-plus and object-path syntaxes. Examples: $.property.value
or property.value
Mockoon is a powerful API mocking tool that makes it easy to create and manage mock APIs for prototyping and testing. With an intuitive interface, you can quickly set up mock servers, customize responses, and simulate scenarios in real-time, enhancing team collaboration and speeding up development.
This online tool allows you to extract values from JSON data using JSONPath or object-path syntaxes. The extracted content is updated in real time as you type your path.
This playground uses the same logic as the Mockoon features that support JSONPath and object-path syntaxes:
JSONPath is a query language for JSON data. It allows you to analyze, transform, and extract data from JSON documents.
JSONPath is used in many programming languages and data processing tools. It is similar to XPath for XML documents.
Symbol | Description |
---|---|
$ | the root object/element |
@ | the current object/element |
. or [] | child operator |
.. | nested descendants |
* | wildcard, all objects/elements regardless of their names |
[] | subscript operator |
[,] | JSONPath allows alternate names or array indices as a set. |
[start:end:step] | array slice operator |
?() | applies a filter (script) expression |
{
"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
}
],
"bicycle": {
"color": "red",
"price": 19.95
}
}
}
JSONPath | Result |
---|---|
$.store.book[*].author | the authors of all books in the store |
$..author | all authors |
$.store.* | all things in store, which are some books and a red bicycle |
$.store..price | the price of everything in the store |
$..book[2] | the third book |
$..book[(@.length-1)] $..book[-1:] | the last book in order |
$..book[0,1] $..book[:2] | the first two books |
$..book[?(@.isbn)] | filter all books with isbn number |
$..book[?(@.price<10)] | filter all books cheapier than 10 |
$..* | All members of JSON data item |
object-path is a simpler library to access and manipulate properties on objects using paths. It is similar to JSONPath but less powerful and more straightforward to use.
object-path is mainly using the dot and bracket notations to access nested properties. However, it doesn't support all the features of JSONPath.
{
"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
}
],
"bicycle": {
"color": "red",
"price": 19.95
}
}
}
object-path | Result |
---|---|
store.book | the books in the store, which are an array of objects |
store.bicycle.color | the color of the bicycle |
store.book[0].author | the author of the first book |
store.book[1].title | the title of the second book |