@ RobotKeyword public Object findJsonElement ( String source , String jsonPath , String method , String data , String contentType ) throws Exception { System . out . println ( "*DEBUG* Reading jsonPath: " + jsonPath ) ; String json = requestUtil . readSource ( source , method , data , contentType ) ; Object value ; try { value = JsonPath . read ( json , jsonPath ) ; } catch ( PathNotFoundException e ) { throw new JsonElementNotFoundException ( "Path '" + jsonPath + "' was not found in JSON" ) ; } return value ; }
Find JSON element by jsonPath from the source and return its value if found .