Toolbox for developers / Online JSON test - Evaluator

JSONPath Tester

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.

Your JSONPath expression

Your JSON structure

Results



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
$..name All 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[*].area The area of all rooms in the house


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

Comments





The tools are provided "as is", without warranty of any kind, either express or implied.