JSONPath Tester

 
Your JSONPath expression

Your JSON structure
Results


Online JSONPath tester tool allows you to test and debug your JSONPath expressions against an JSON string or file.

You can see JSONPath syntax to help you to find your JSONPath query.

You can see the user guide to help you to use this JSONPath tester.




User guide

In order to test your JSONPath expression, you must:

  • Fill "Your JSONPath expression" editor
  • Fill "Your JSON structure" editor
The result will be automatically generated and available in the "Results" editor.

To fill "Your JSON structure" editor, you can:

  • Copy and paste your JSON structure
  • Drag and drop your JSON file
  • Click on "Browse JSON file" button in order to load your JSON file
  • Directly type your JSON code in the editor

It use JSONPath Plus library.


About JSONPath

XPath (XML Path Language) is a query language for selecting nodes from a XML data.
JSONPath is XPath for JSON: JSONPath is a query language for JSON.

Developers can use JSONPath in a variety of programming languages (Javascript, PHP, Java, ...).

JSONPath syntax

JSONPathDescription
$The root object / element
@The current object / element
.Child member operator
..Recursive descendant operator; JSONPath borrows this syntax from E4X
*Wildcard matching all objects/elements regardless their names
[]Subscript operator
[,]Union operator for alternate names or array indices as a set
[start:end:step]Array slice operator borrowed from ES4 / Python
?()Applies a filter (script) expression via static evaluation
()Script expression via static evaluation

Example JSONPath expressions

JSON structure example:
{
	"house": {
		"room": [ 
			{
				"name": "Bedroom",
				"area": 10
			}, 
			{
				"name": "Bathroom",
				"area": 9
			}, 
			{
				"name": "Kitchen",
				"appliance": "microwave",
				"area": 12
			}
		],
		"garden": {
			"area": 150
		}
	}
}	
				

The following are some examples of JSONPath expressions:

JSONPathDescription
$.house.*All things in house, which are some rooms and a garden
$..nameAll names
$..room[2]The third room
$..room[(@.length-1)]The last room
$..room[-1:]The last room
$..room[0,1]The first two rooms
$..room[:2]The first two rooms
$..room[?(@.appliance)]Filter all rooms with home appliance
$..room[?(@.area<10)]Filter all rooms smaller than 10
$..room[?(@.area<10 && @.name=="Bedroom")]Filter all Bedrooms smaller than 10
$.house.room[*].areaThe area of all rooms in the house


You can report a bug or give feedback by adding a comment (below) or by clicking "Contact me" link (at the top right hand corner of the page).

Comments




DANIEL MARQUES PEREIRA-2021-01-19 14:07
that would be awesome if it had intellisense


Cyril-2021-01-19 14:30
It is a good idea!


asd-2022-02-05 18:13
So, make it now, don't waste!


Lienix-2022-02-22 12:09
I wonder how an working example with an 'in' expression would look like

E.g. instead of this
$.house.room[?(@.name == 'Bedroom')]

use an 'in' expression to geht two results:
$.house.room[?(@.name in ['Bedroom', 'Bathroom'])]

But that isn' t working! What is the trick to make it correct?


Lucas-2022-03-23 08:37
Would you add some information about filtering with conditionals? e.g. contains, in, =~regex, sort of things?