Skip to main content
added 197 characters in body
Source Link
Alexey R.
  • 11.6k
  • 5
  • 20
  • 39

Use the following jsonpath query:

$.serviceLines[0].customerProducts[?customerProducts.findAll{product -> product.highLevelProduct == 'HSI'}.customerProductIdentifier

Test:

System.out.println(@js.highLevelProduct=='HSI'get("serviceLines[0].customerProducts.findAll{product -> product.highLevelProduct == 'HSI'}.customerProductIdentifier")].customerProductIdentifiertoString());

Note, that it will return list of identifiers in case your JSON contains several objects meeting your requirement.

Use the following jsonpath query:

$.serviceLines[0].customerProducts[?(@.highLevelProduct=='HSI')].customerProductIdentifier

Note, that it will return list of identifiers in case your JSON contains several objects meeting your requirement.

Use the following jsonpath query:

serviceLines[0].customerProducts.findAll{product -> product.highLevelProduct == 'HSI'}.customerProductIdentifier

Test:

System.out.println(js.get("serviceLines[0].customerProducts.findAll{product -> product.highLevelProduct == 'HSI'}.customerProductIdentifier").toString());

Note, that it will return list of identifiers in case your JSON contains several objects meeting your requirement.

Source Link
Alexey R.
  • 11.6k
  • 5
  • 20
  • 39

Use the following jsonpath query:

$.serviceLines[0].customerProducts[?(@.highLevelProduct=='HSI')].customerProductIdentifier

Note, that it will return list of identifiers in case your JSON contains several objects meeting your requirement.