public static function FeedsExJsonUtility::decodeJsonArray in Feeds extensible parsers 7
Decodes a JSON string into an array.
Parameters
string $json: A JSON string.
Return value
array A PHP array.
Throws
RuntimeException Thrown if the encoded JSON does not result in an array.
3 calls to FeedsExJsonUtility::decodeJsonArray()
- FeedsExJmesPathLines::parseItems in src/
FeedsExJmesPathLines.inc - Performs the actual parsing.
- FeedsExJsonPath::executeContext in src/
FeedsExJsonPath.inc - Returns rows to be parsed.
- FeedsExJsonPathLines::parseItems in src/
FeedsExJsonPathLines.inc - Performs the actual parsing.
File
- src/
Json/ Utility.php, line 81 - Contains FeedsExJsonUtility.
Class
- FeedsExJsonUtility
- Various helpers for handling JSON.
Code
public static function decodeJsonArray($json) {
$parsed = drupal_json_decode($json);
if (!is_array($parsed)) {
throw new RuntimeException(t('The JSON is invalid.'));
}
return $parsed;
}