public static function jsonDecode($json, $assoc = false) {
        if (!$json) {
            throw new \Exception("Can't json_decode empty string [{$json}]");
        }

        $data = json_decode($json, $assoc);

        if ($data === null) {
            throw new \Exception("Failed to json_decode [{$json}]");
        }

        return $data;
    }
public static function jsonDecode($json, $assoc = false) {
        if (!$json) {
            throw new \Exception("Can't json_decode empty string [{$json}]");
        }

        $data = json_decode($json, $assoc);

        if ($data === null) {
            throw new \Exception("Failed to json_decode [{$json}]");
        }

        return $data;
    }
public static function jsonDecode ( $ json , $ assoc = false ) { if ( ! $ json ) { throw new \ Exception ( "Can't json_decode empty string [{$json}]" ) ; } $ data = json_decode ( $ json , $ assoc ) ; if ( $ data === null ) { throw new \ Exception ( "Failed to json_decode [{$json}]" ) ; } return $ data ; }
json_decode helper that throws exceptions when it fails to decode

@param      $json
@param bool $assoc
@return mixed
@throws \Exception
json_decode helper that throws exceptions when it fails to decode