Piwik\Common::json_decode PHP Méthode

json_decode() public static méthode

JSON decode wrapper - missing or broken in some php 5.x versions
Deprecation:
public static json_decode ( string $json, boolean $assoc = false ) : mixed
$json string
$assoc boolean
Résultat mixed
    public static function json_decode($json, $assoc = false)
    {
        return json_decode($json, $assoc);
    }

Usage Example

 private function loadJsonMetadata($path)
 {
     if (!file_exists($path)) {
         return array();
     }
     $json = file_get_contents($path);
     if (!$json) {
         return array();
     }
     $info = Common::json_decode($json, $assoc = true);
     if (!is_array($info) || empty($info)) {
         throw new Exception("Invalid JSON file: {$path}");
     }
     return $info;
 }
All Usage Examples Of Piwik\Common::json_decode