def METHOD_NAME(both_fake_remote_clients, capsys):
    """Test that the validator writes compliant JSON when requested."""
    from optimade.server.main_index import app
    validator = ImplementationValidator(
        client=both_fake_remote_clients,
        index=both_fake_remote_clients.app == app,
        respond_json=True,
    )
    validator.validate_implementation()
    captured = capsys.readouterr()
    json_response = json.loads(captured.out)
    assert json_response["failure_count"] == 0, json_response
    assert json_response["internal_failure_count"] == 0, json_response
    assert json_response["optional_failure_count"] == 0, json_response
    assert validator.results.failure_count == 0, json_response
    assert validator.results.internal_failure_count == 0, json_response
    assert validator.results.optional_failure_count == 0, json_response
    assert dataclasses.asdict(validator.results) == json_response, json_response
    assert validator.valid