Claim: Andrew Jackson was a president.

John Quincy Adams -LRB- -LSB- ˈkwɪnzi -RSB- July 11 , 1767 -- February 23 , 1848 -RRB- was an American statesman who served as a diplomat , United States Senator , member of the House of Representatives , and was the sixth President of the United States from 1825 to 1829 . He was a member of the Federalist , Democratic-Republican , National Republican , and later the Anti-Masonic and Whig parties . He was the son of President John Adams and Abigail Adams and thus contributed to the formation of the Adams political family .   Adams shaped U.S. foreign policy using his ardently nationalist commitment to U.S. republican values . As a diplomat , Adams played an important role in negotiating key treaties , most notably the Treaty of Ghent , which ended the War of 1812 . As Secretary of State , he negotiated with Britain over the United States ' northern border with Canada , negotiated with Spain the annexation of Florida , and drafted the Monroe Doctrine . Historians generally concur that he was one of the greatest diplomats and secretaries of state in American history . In his biography , Samuel Flagg Bemis argues that Adams was able to `` gather together , formulate , and practice the fundamentals of American foreign-policy -- self-determination , independence , noncolonization , nonintervention , nonentanglement in European politics , Freedom of the Seas , -LSB- and -RSB- freedom of commerce . ''   Adams was elected president in a close and controversial four-way contest in 1824 . As president he sought to modernize the American economy and promote education . Adams enacted a part of his agenda and paid off much of the national debt . However he was stymied time and again by a Congress controlled by opponents , and his lack of patronage networks helped politicians sabotage him . He lost his 1828 bid for re-election to Andrew Jackson . He has been portrayed by recent historians as an exemplar and moral leader during an era of modernization , when new modes of communication spread messages of religious revival , social reform , and party politics , and improved transportation moved goods , money , and people more rapidly . Historians have in the aggregate ranked Adams as the 21st most successful president .   After leaving office , he was elected as U.S. Representative from Massachusetts in 1830 , serving for the last 17 years of his life with greater acclaim than he had achieved as president . Animated by his growing revulsion against slavery , Adams became a leading opponent of the Slave Power . Adams predicted the Union 's dissolution over slavery , and in such a case , felt the president could abolish slavery by using his war powers . Adams also became a critic of the annexation of Texas and the Mexican-American War , which he saw as an aggressive war for territory .