You are here

private function FeedsJSONPathParser::jsonPath in Feeds JSONPath Parser 6

Same name and namespace in other branches
  1. 7 FeedsJSONPathParser.inc \FeedsJSONPathParser::jsonPath()

Utilizes the jsonPath function from jsonpath-0.8.1.php

jsonPath returns false if the expression returns zero results and that will mess up our for loops, so return an empty array instead.

@todo Firgure out error handling.

@$expression The JSONPath expression.

Parameters

$array: The input array to parse

Return value

array Returns an array that is the output of jsonPath

2 calls to FeedsJSONPathParser::jsonPath()
FeedsJSONPathParser::parse in ./FeedsJSONPathParser.inc
Implementation of FeedsParser::parse().
FeedsJSONPathParser::parseSourceElement in ./FeedsJSONPathParser.inc
Parses one item from the context array.

File

./FeedsJSONPathParser.inc, line 88
Provides the Class for Feeds JSONPath Parser.

Class

FeedsJSONPathParser
Base class for the HTML and XML parsers.

Code

private function jsonPath($array, $expression) {
  $result = jsonPath($array, $expression);
  return $result === FALSE ? array() : $result;
}