def json_get_default(json: JsonValue, path: str,<EOL>default: Any, expected_type: Any = ANY) -> Any:
try:<EOL><INDENT>return json_get(json, path, expected_type)<EOL><DEDENT>except (ValueError, IndexError):<EOL><INDENT>return default<EOL><DEDENT>
Get a JSON value by path, optionally checking its type.

    This works exactly like json_get(), but instead of raising
    ValueError or IndexError when a path part is not found, return
    the provided default value:

    >>> json_get_default({}, "/foo", "I am a default value")
    'I am a default value'

    TypeErrors will be raised as in json_get() if an expected_type
    is provided:

    >>> json_get_default({"foo": "bar"}, "/foo", 123, int)
    Traceback (most recent call last):
        ...
    TypeError: wrong JSON type int != str