You are here

protected function JsonPathParser::search in Feeds extensible parsers 8

Searches an array via JSONPath.

Parameters

array $data: The array to search.

string $expression: The JSONPath expression.

Return value

mixed The search results.

3 calls to JsonPathParser::search()
JsonPathLinesParser::executeSourceExpression in src/Feeds/Parser/JsonPathLinesParser.php
Executes a single source expression.
JsonPathParser::executeContext in src/Feeds/Parser/JsonPathParser.php
Returns rows to be parsed.
JsonPathParser::executeSourceExpression in src/Feeds/Parser/JsonPathParser.php
Executes a single source expression.

File

src/Feeds/Parser/JsonPathParser.php, line 115

Class

JsonPathParser
Defines a JSON parser using JSONPath.

Namespace

Drupal\feeds_ex\Feeds\Parser

Code

protected function search(array $data, $expression) {
  $json_path = new JSONPath($data);
  return $json_path
    ->find($expression)
    ->getData();
}