public function JsonUtility::decodeJsonArray in Feeds extensible parsers 8
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.
File
- src/
Utility/ JsonUtility.php, line 70
Class
- JsonUtility
- Various helpers for handling JSON.
Namespace
Drupal\feeds_ex\UtilityCode
public function decodeJsonArray($json) {
$parsed = Json::decode($json);
if (!is_array($parsed)) {
throw new \RuntimeException($this
->t('The JSON is invalid.'));
}
return $parsed;
}