You are here

public function FeedsExJsonPathParserFlow::search in Feeds extensible parsers 7

Searches an array via JSONPath.

Parameters

array $data: The array to search.

string $expression: The JSONPath expression.

Return value

mixed The search results.

Overrides FeedsExJsonPathParserInterface::search

File

src/FeedsExJsonPath.inc, line 183
Contains FeedsExJsonPath.

Class

FeedsExJsonPathParserFlow
Wraps the Flow JSONPath implementation.

Code

public function search(array $data, $expression) {

  // Use class string so that PHP 5.2 doesn't complain.
  $class = 'Flow\\JSONPath\\JSONPath';
  $json_path = new $class($data);
  return $json_path
    ->find($expression)
    ->data();
}