get json query result

Query a JSON document by JSONPath.
NameDescriptionTypeModifier
json

JSON target document that the query runs against.

StringNone
jsonpath

JSONPath query string

StringNone
variable

(Optional) Variable to receive the returned query result.

StringNone
The query result.
This action may be used within the following project items: test modules and user-defined actions.
The following settings are applicable to this action: remove double quotes from cells.

Given the following JSON document:

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

To insert the entire JSON document's content above into the json argument, for example, use JSON Editor Online to remove all white spaces. The returned JSON document resembles the following.

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

        
            	json	jsonpath	variable
get json query result	{"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}}}	store.book[0].category	>>category
        
    
  • JSONPath of REST Assured, a Java framework for simplifying testing of REST based services and currently employed in TestArchitect, uses Groovy GPath expressions. A tutorial on GPath is beyond the scope of this help system. For more information on GPath, you can refer to this site.
  • To insert an entire JSON document’s content into the json argument, all whitespaces must be removed manually to avoid automation failure.

    Tip: 
    You can use various tools to compact JSON data to remove all whitepsaces. For example: JSON Editor Online.

  • If the variable in argument variable has not been declared, the action creates it as a global.
  • This action supports the <ignore> modifier. If the string <ignore> is present as the value of any of the arguments, or any argument contains an expression that evaluates to <ignore>, the action is skipped during execution.

Copyright © 2024 LogiGear Corporation. All rights reserved. LogiGear is a registered trademark, and Action Based Testing and TestArchitect are trademarks of LogiGear Corporation. All other trademarks contained herein are the property of their respective owners.

LogiGear Corporation

1730 S. Amphlett Blvd. Suite 200, San Mateo, CA 94402

Tel: +1 (650) 572-1400