Przejdź do głównej zawartości

JsonPath

This function returns property value for specified json

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

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

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")