JsonPath

This function returns property value for specified json

Syntax

JsonPath("jsonString", "selector");

Function arguments

  • jsonString – (String) Json string
  • selector – (String) Selector of property to get from json string. JSONPath is supported.

Return value

This function returns String.
The value of specified property, or an empty string if invalid json or invalid selector was provided

Examples

Example 1:
This will extract 'name’ property value from json stored in 'jsonString’ form field

JsonPath("[jsonString]", "name")

Example 2:
This will extract 'age’ property value from 'person’ object from json stored in rule variable 'jsonVariable’

JsonPath(jsonVariable, "person.age")

Example 3:
This will extract 'model’ property value from 3rd array item in 'cars’ array from json stored in 'jsonString’ form field

JsonPath("[jsonString]", "cars[3].model")
Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.