public static function decode($value, $assoc = false)
    {
        $data = json_decode((string) $value, $assoc);

        switch (json_last_error()) {
            case JSON_ERROR_NONE:
                return $data;
                break;

            case JSON_ERROR_DEPTH:
                throw new \RuntimeException('Invalid JSON structure');
                break;

            case JSON_ERROR_STATE_MISMATCH:
            case JSON_ERROR_CTRL_CHAR:
            case JSON_ERROR_SYNTAX:
            default:
                throw new \RuntimeException('Syntax error, malformed JSON');
                break;
        }
    }
public static function decode($value, $assoc = false)
    {
        $data = json_decode((string) $value, $assoc);

        switch (json_last_error()) {
            case JSON_ERROR_NONE:
                return $data;
                break;

            case JSON_ERROR_DEPTH:
                throw new \RuntimeException('Invalid JSON structure');
                break;

            case JSON_ERROR_STATE_MISMATCH:
            case JSON_ERROR_CTRL_CHAR:
            case JSON_ERROR_SYNTAX:
            default:
                throw new \RuntimeException('Syntax error, malformed JSON');
                break;
        }
    }
public static function decode ( $ value , $ assoc = false ) { $ data = json_decode ( ( string ) $ value , $ assoc ) ; switch ( json_last_error ( ) ) { case JSON_ERROR_NONE : return $ data ; break ; case JSON_ERROR_DEPTH : throw new \ RuntimeException ( 'Invalid JSON structure' ) ; break ; case JSON_ERROR_STATE_MISMATCH : case JSON_ERROR_CTRL_CHAR : case JSON_ERROR_SYNTAX : default : throw new \ RuntimeException ( 'Syntax error, malformed JSON' ) ; break ; } }
Returns a php variable from the json decoded value. Throws an exception
if decoding the data is not possible

@param string $value
@param boolean $assoc
@return mixed
Returns a php variable from the json decoded value . Throws an exception if decoding the data is not possible