• ARTICLE
  • STRING
  • CONVERTER
  • ENCRYPT
  • NETWORK
  • MORE
    CHART
    MATH
    COORDINATE
    IMAGE
    FILE
  • ARTICLE
    STRING
    CONVERTER
    ENCRYPT
    NETWORK
    MORE
    CHART
    MATH
    COORDINATE
    IMAGE
    FILE
logo Online Tools
7 Comments Favorite Copy Link Share

JSONPath Evaluator Online


1. 在浏览器中执行查询 2. 部分语法支持可能不够完善

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

Online JSON Path testing tool, input JSON data, use JSON Path syntax, extract JSON data. The JSON Path query supports browser JavaScript engines and server-side Java engines.

  1. JSONPath: Query Expressions for JSON .
  2. Engine : Select to use JavaScript engine or Java engine to execute JSON Path query. JavaScript Engine : Execute queries in the browser, data will not be uploaded to the cloud, and some syntax support is not comprehensive enough. Java Engine : Execute queries on the server with comprehensive syntax support and powerful functionality.
  3. JSONPath : Input the JSON Path query statement. Please refer to the document below for the supported syntax.
  4. This tool Java Engine has a certain frequency limit, please use this tool reasonably. Anonymous : 120/IP*Hour, Normal user : 120/Hour, VIP : 720/Hour, Senior VIP : 720/Hour.
  5. JavaScript syntax documentation:
    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
  6. Java syntax documentation:
    1. Operators
      Operator Description
      $ The root element to query. This starts all path expressions.
      @ The current node being processed by a filter predicate.
      * Wildcard. Available anywhere a name or numeric are required.
      .. Deep scan. Available anywhere a name is required.
      .<name> Dot-notated child
      ['<name>' (, '<name>')] Bracket-notated child or children
      [<number> (, <number>)] Array index or indexes
      [start:end] Array slice operator
      [?(<expression>)] Filter expression. Expression must evaluate to a boolean value.
    2. Functions : Functions can be invoked at the tail end of a path - the input to a function is the output of the path expression. The function output is dictated by the function itself.
      Function Description Output type
      min() Provides the min value of an array of numbers Double
      max() Provides the max value of an array of numbers Double
      avg() Provides the average value of an array of numbers Double
      stddev() Provides the standard deviation value of an array of numbers Double
      length() Provides the length of an array Integer
      sum() Provides the sum value of an array of numbers Double
      keys() Provides the property keys (An alternative for terminal tilde ~) Set<E>
      concat(X) Provides a concatinated version of the path output with a new item like input
      append(X) add an item to the json path output array like input
      first() Provides the first item of an array Depends on the array
      last() Provides the last item of an array Depends on the array
      index(X) Provides the item of an array of index: X, if the X is negative, take from backwards Depends on the array
    3. Filter Operators : Filters are logical expressions used to filter arrays. A typical filter would be [?(@.age > 18)] where @ represents the current item being processed. More complex filters can be created with logical operators && and ||. String literals must be enclosed by single or double quotes ([?(@.color == 'blue')] or [?(@.color == "blue")]).
      Operator Description
      == left is equal to right (note that 1 is not equal to '1')
      != left is not equal to right
      < left is less than right
      <= left is less or equal to right
      > left is greater than right
      >= left is greater than or equal to right
      =~ left matches regular expression [?(@.name =~ /foo.*?/i)]
      in left exists in right [?(@.size in ['S', 'M'])]
      nin left does not exists in right
      subsetof left is a subset of right [?(@.sizes subsetof ['S', 'M', 'L'])]
      anyof left has an intersection with right [?(@.sizes anyof ['M', 'L'])]
      noneof left has no intersection with right [?(@.sizes noneof ['M', 'L'])]
      size size of left (array or string) should match right
      empty left (array or string) should be empty
    4. JSONPath Examples
      JsonPath Result
      $.store.book[*].author The authors of all books
      $..author All authors
      $.store.* All things, both books and bicycles
      $.store..price The price of everything
      $..book[2] The third book
      $..book[-2] The second to last book
      $..book[0,1] The first two books
      $..book[:2] All books from index 0 (inclusive) until index 2 (exclusive)
      $..book[1:2] All books from index 1 (inclusive) until index 2 (exclusive)
      $..book[-2:] Last two books
      $..book[2:] All books from index 2 (inclusive) to last
      $..book[?(@.isbn)] All books with an ISBN number
      $.store.book[?(@.price < 10)] All books in store cheaper than 10
      $..book[?(@.price <= $['expensive'])] All books in store that are not "expensive"
      $..book[?(@.author =~ /.*REES/i)] All books matching regex (ignore case)
      $..* Give me every thing
      $..book.length() The number of books

Sample JSON Data Copy

{
"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
  }
},
"expensive": 10
}