Hillary Clinton took the media and her political opponents to task in her new book for their treatment of the Clinton Foundation, arguing her family's eponymous charity suffered unfounded attacks and dedicating several pages to a list of its biggest accomplishments.

Clinton also conflated the controversy surrounding her family's multibillion dollar foundation with the scandal that befell President Trump's charity, which was accused during the campaign of spending lavishly on personal items.

"Instead of admitting mistakes, [Trump] lashes out, demeans and insults others — often projecting by accusing others of doing what he himself has done or is about to do," Clinton wrote in her memoir, "What Happened," which hit shelves on Tuesday.

"So if he knows that the Donald J. Trump Foundation is little more than a personal piggy bank, he'll turn around and accuse, with no evidence, the well-respected Clinton Foundation of being corrupt," Clinton added.

Evidence of at least the appearance of impropriety did follow the Clinton Foundation during the campaign, however. A right-leaning author was able to fill an entire book with examples of foundation donors receiving favorable treatment from the State Department when Clinton served as secretary of state. Clinton appointed dozens of foundation donors to prestigious State Department boards during her tenure. And a review of her State Department calendars by the Associated Press found that more than half of her meetings with people outside the U.S. government were with donors to her family's charity.

Still, Clinton wrote that the attacks on her family's foundation surprised her.

"I never imagined that this widely respected global charity would be savagely smeared and attacked as it was," Clinton said.

"For years, the foundation and CGI had been supported by Republicans and Democrats alike. Independent philanthropy watchdogs CharityWatch, GuideStar and Charity Navigator gave the Clinton Foundation top marks for having a measurable positive impact," she added. "But none of that stopped brutal partisan attacks from raining down during the campaign."

Philanthropy watchdogs have not always rated the Clinton Foundation highly, however. In 2015, amid a spate of stories that highlighted the quid pro quos that seemed to follow some of the donations the foundation received, Charity Navigator placed the Clinton Foundation on its watch list. The watchdog group later removed Clinton's charity from the list.

In her book, Clinton cited a Columbia Journalism Review analysis which "showed that during the campaign there was twice as much written about the Clinton Foundation as there was on any of the Trump scandals, and nearly all of it was negative."

"That gets to me," Clinton wrote.