logo Online Tools

JSONPath Evaluator Online

Input JSON

Output Result

JSONPath Evaluator Online-summary

Jsonpath evaluator online provides jsonpath online evaluate function. You can enter JSON data and then use jsonpath to extract the data.

JSONPath Evaluator Online-instructions

JSONPath Syntax Reference

Sample JSON data:

{
"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
  }
}
}
      

JSONPath Syntax Interpretation:

JSONPath Result Notes
$.store.book[*].author The authors of all books in the store Can also be represented without the $. as store.book[*].author (though this is not present in the original spec); note that some character literals ($ and @) require escaping, however
$..author All authors
$.store.* All things in store, which are its books (a book array) and a red bicycle (a bicycle object).
$.store..price The price of everything in the store.
$..book[2] The third book (book object)
$..book[(@.length-1)]
$..book[-1:]
The last book in order. To access a property with a special character, utilize [(@['...'])] for the filter (this particular feature is not present in the original spec)
$..book[0,1]
$..book[:2]
The first two books
$..book[0][category,author] The categories and authors of first book
$..book[?(@.isbn)] Filter all books with an ISBN number To access a property with a special character, utilize [?@['...']] for the filter (this particular feature is not present in the original spec)
$..book[?(@.price<10)] Filter all books cheaper than 10
$..*[?(@property === 'price' && @ !== 8.95)] Obtain all property values of objects whose property is price and which does not equal 8.95 With the bare @ allowing filtering objects by property value (not necessarily within arrays), you can add ^ after the expression to get at the object possessing the filtered properties
$ The root of the JSON object (i.e., the whole object itself) To get a literal $ (by itself or anywhere in the path), you must use the backtick escape
$..* All members of a JSON structure beneath the root.
$.. All parent components of a JSON structure including root. This behavior was not directly specified in the original spec
$..[?(@.price>19)]^ Parent of those specific items with a price greater than 19 (i.e., the store value as the parent of the bicycle and the book array as parent of an individual book) Parent (caret) not present in the original spec
$.store.*~ The property names of the store sub-object ("book" and "bicycle"). Useful with wildcard properties. Property name (tilde) is not present in the original spec
$.store.book[?(@path !== "$['store']['book'][0]")] All books besides that at the path pointing to the first @path not present in the original spec
$..book[?(@parent.bicycle && @parent.bicycle.color === "red")].category Grabs all categories of books where the parent object of the book has a bicycle child whose color is red (i.e., all the books) @parent is not present in the original spec
$..book.*[?(@property !== "category")] Grabs all children of "book" except for "category" ones @property is not present in the original spec
$..book[?(@property !== 0)] Grabs all books whose property (which, being that we are reaching inside an array, is the numeric index) is not 0 @property is not present in the original spec
$.store.*[?(@parentProperty !== "book")] Grabs the grandchildren of store whose parent property is not book (i.e., bicycle's children, "color" and "price") @parentProperty is not present in the original spec
$..book.*[?(@parentProperty !== 0)] Get the property values of all book instances whereby the parent property of these values (i.e., the array index holding the book item parent object) is not 0 @parentProperty is not present in the original spec
$..book[?(@.price === @root.store.book[2].price)] Filter all books whose price equals the price of the third book @root is not present in the original spec
$..book..*@number() Get the numeric values within the book array @number(), the other basic types (@boolean(), @string()), other low-level derived types (@null(), @object(), @array()), the JSONSchema-added type, @integer(), the compound type @scalar() (which also accepts undefined and non-finite numbers for JavaScript objects as well as all of the basic non-object/non-function types), the type, @other(), to be used in conjunction with a user-defined callback (see otherTypeCallback) and the following non-JSON types that can nevertheless be used with JSONPath when querying non-JSON JavaScript objects (@undefined(), @function(), @nonFinite()) are not present in the original spec
$..book.*[?(@property === "category" && @.match(/TION$/i))] All categories of books which match the regex (end in 'TION' case insensitive) @property is not present in the original spec.
$..book.*[?(@property.match(/bn$/i))]^ All books which have a property matching the regex (end in 'TION' case insensitive) @property is not present in the original spec. Note: Uses the parent selector ^ at the end of the expression to return to the parent object; without the parent selector, it matches the two isbn key values.
` (e.g., `$ to match a property literally named $) Escapes the entire sequence following (to be treated as a literal) ` is not present in the original spec; to get a literal backtick, use an additional backtick to escape
0 comments